activesupport 5.1.1 → 6.1.1

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.

Files changed (262) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +360 -442
  3. data/MIT-LICENSE +1 -1
  4. data/README.rdoc +5 -4
  5. data/lib/active_support/actionable_error.rb +48 -0
  6. data/lib/active_support/all.rb +2 -0
  7. data/lib/active_support/array_inquirer.rb +6 -2
  8. data/lib/active_support/backtrace_cleaner.rb +31 -3
  9. data/lib/active_support/benchmarkable.rb +3 -1
  10. data/lib/active_support/builder.rb +2 -0
  11. data/lib/active_support/cache/file_store.rb +37 -36
  12. data/lib/active_support/cache/mem_cache_store.rb +65 -53
  13. data/lib/active_support/cache/memory_store.rb +61 -33
  14. data/lib/active_support/cache/null_store.rb +10 -3
  15. data/lib/active_support/cache/redis_cache_store.rb +493 -0
  16. data/lib/active_support/cache/strategy/local_cache.rb +68 -22
  17. data/lib/active_support/cache/strategy/local_cache_middleware.rb +2 -0
  18. data/lib/active_support/cache.rb +305 -127
  19. data/lib/active_support/callbacks.rb +106 -98
  20. data/lib/active_support/concern.rb +79 -6
  21. data/lib/active_support/concurrency/load_interlock_aware_monitor.rb +35 -0
  22. data/lib/active_support/concurrency/share_lock.rb +2 -1
  23. data/lib/active_support/configurable.rb +12 -14
  24. data/lib/active_support/configuration_file.rb +46 -0
  25. data/lib/active_support/core_ext/array/access.rb +21 -7
  26. data/lib/active_support/core_ext/array/conversions.rb +7 -5
  27. data/lib/active_support/core_ext/array/extract.rb +21 -0
  28. data/lib/active_support/core_ext/array/extract_options.rb +2 -0
  29. data/lib/active_support/core_ext/array/grouping.rb +2 -0
  30. data/lib/active_support/core_ext/array/inquiry.rb +2 -0
  31. data/lib/active_support/core_ext/array/wrap.rb +2 -0
  32. data/lib/active_support/core_ext/array.rb +3 -1
  33. data/lib/active_support/core_ext/benchmark.rb +4 -2
  34. data/lib/active_support/core_ext/big_decimal/conversions.rb +2 -0
  35. data/lib/active_support/core_ext/big_decimal.rb +2 -0
  36. data/lib/active_support/core_ext/class/attribute.rb +50 -47
  37. data/lib/active_support/core_ext/class/attribute_accessors.rb +2 -0
  38. data/lib/active_support/core_ext/class/subclasses.rb +18 -40
  39. data/lib/active_support/core_ext/class.rb +2 -0
  40. data/lib/active_support/core_ext/date/acts_like.rb +2 -0
  41. data/lib/active_support/core_ext/date/blank.rb +2 -0
  42. data/lib/active_support/core_ext/date/calculations.rb +8 -5
  43. data/lib/active_support/core_ext/date/conversions.rb +12 -10
  44. data/lib/active_support/core_ext/date/zones.rb +2 -0
  45. data/lib/active_support/core_ext/date.rb +2 -0
  46. data/lib/active_support/core_ext/date_and_time/calculations.rb +61 -37
  47. data/lib/active_support/core_ext/date_and_time/compatibility.rb +18 -1
  48. data/lib/active_support/core_ext/date_and_time/zones.rb +2 -1
  49. data/lib/active_support/core_ext/date_time/acts_like.rb +2 -0
  50. data/lib/active_support/core_ext/date_time/blank.rb +2 -0
  51. data/lib/active_support/core_ext/date_time/calculations.rb +3 -1
  52. data/lib/active_support/core_ext/date_time/compatibility.rb +7 -5
  53. data/lib/active_support/core_ext/date_time/conversions.rb +2 -1
  54. data/lib/active_support/core_ext/date_time.rb +2 -0
  55. data/lib/active_support/core_ext/digest/uuid.rb +3 -1
  56. data/lib/active_support/core_ext/digest.rb +3 -0
  57. data/lib/active_support/core_ext/enumerable.rb +174 -71
  58. data/lib/active_support/core_ext/file/atomic.rb +3 -1
  59. data/lib/active_support/core_ext/file.rb +2 -0
  60. data/lib/active_support/core_ext/hash/conversions.rb +7 -5
  61. data/lib/active_support/core_ext/hash/deep_merge.rb +8 -12
  62. data/lib/active_support/core_ext/hash/deep_transform_values.rb +46 -0
  63. data/lib/active_support/core_ext/hash/except.rb +4 -2
  64. data/lib/active_support/core_ext/hash/indifferent_access.rb +2 -0
  65. data/lib/active_support/core_ext/hash/keys.rb +3 -30
  66. data/lib/active_support/core_ext/hash/reverse_merge.rb +5 -2
  67. data/lib/active_support/core_ext/hash/slice.rb +8 -29
  68. data/lib/active_support/core_ext/hash.rb +3 -2
  69. data/lib/active_support/core_ext/integer/inflections.rb +2 -0
  70. data/lib/active_support/core_ext/integer/multiple.rb +3 -1
  71. data/lib/active_support/core_ext/integer/time.rb +7 -14
  72. data/lib/active_support/core_ext/integer.rb +2 -0
  73. data/lib/active_support/core_ext/kernel/concern.rb +2 -0
  74. data/lib/active_support/core_ext/kernel/reporting.rb +2 -0
  75. data/lib/active_support/core_ext/kernel/singleton_class.rb +2 -0
  76. data/lib/active_support/core_ext/kernel.rb +2 -1
  77. data/lib/active_support/core_ext/load_error.rb +3 -8
  78. data/lib/active_support/core_ext/marshal.rb +4 -0
  79. data/lib/active_support/core_ext/module/aliasing.rb +2 -0
  80. data/lib/active_support/core_ext/module/anonymous.rb +2 -0
  81. data/lib/active_support/core_ext/module/attr_internal.rb +4 -2
  82. data/lib/active_support/core_ext/module/attribute_accessors.rb +44 -56
  83. data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +18 -18
  84. data/lib/active_support/core_ext/module/concerning.rb +15 -10
  85. data/lib/active_support/core_ext/module/delegation.rb +103 -58
  86. data/lib/active_support/core_ext/module/deprecation.rb +2 -0
  87. data/lib/active_support/core_ext/module/introspection.rb +18 -15
  88. data/lib/active_support/core_ext/module/redefine_method.rb +40 -0
  89. data/lib/active_support/core_ext/module/remove_method.rb +5 -23
  90. data/lib/active_support/core_ext/module.rb +3 -1
  91. data/lib/active_support/core_ext/name_error.rb +36 -2
  92. data/lib/active_support/core_ext/numeric/bytes.rb +2 -0
  93. data/lib/active_support/core_ext/numeric/conversions.rb +131 -129
  94. data/lib/active_support/core_ext/numeric/time.rb +7 -15
  95. data/lib/active_support/core_ext/numeric.rb +2 -1
  96. data/lib/active_support/core_ext/object/acts_like.rb +12 -1
  97. data/lib/active_support/core_ext/object/blank.rb +13 -3
  98. data/lib/active_support/core_ext/object/conversions.rb +2 -0
  99. data/lib/active_support/core_ext/object/deep_dup.rb +3 -1
  100. data/lib/active_support/core_ext/object/duplicable.rb +6 -101
  101. data/lib/active_support/core_ext/object/inclusion.rb +2 -0
  102. data/lib/active_support/core_ext/object/instance_variables.rb +2 -0
  103. data/lib/active_support/core_ext/object/json.rb +22 -2
  104. data/lib/active_support/core_ext/object/to_param.rb +2 -0
  105. data/lib/active_support/core_ext/object/to_query.rb +7 -2
  106. data/lib/active_support/core_ext/object/try.rb +19 -7
  107. data/lib/active_support/core_ext/object/with_options.rb +4 -2
  108. data/lib/active_support/core_ext/object.rb +2 -0
  109. data/lib/active_support/core_ext/range/compare_range.rb +82 -0
  110. data/lib/active_support/core_ext/range/conversions.rb +35 -25
  111. data/lib/active_support/core_ext/range/each.rb +5 -2
  112. data/lib/active_support/core_ext/range/include_time_with_zone.rb +28 -0
  113. data/lib/active_support/core_ext/range/overlaps.rb +2 -0
  114. data/lib/active_support/core_ext/range.rb +4 -1
  115. data/lib/active_support/core_ext/regexp.rb +10 -5
  116. data/lib/active_support/core_ext/securerandom.rb +25 -3
  117. data/lib/active_support/core_ext/string/access.rb +7 -16
  118. data/lib/active_support/core_ext/string/behavior.rb +2 -0
  119. data/lib/active_support/core_ext/string/conversions.rb +3 -0
  120. data/lib/active_support/core_ext/string/exclude.rb +2 -0
  121. data/lib/active_support/core_ext/string/filters.rb +44 -1
  122. data/lib/active_support/core_ext/string/indent.rb +2 -0
  123. data/lib/active_support/core_ext/string/inflections.rb +69 -16
  124. data/lib/active_support/core_ext/string/inquiry.rb +3 -0
  125. data/lib/active_support/core_ext/string/multibyte.rb +9 -4
  126. data/lib/active_support/core_ext/string/output_safety.rb +76 -20
  127. data/lib/active_support/core_ext/string/starts_ends_with.rb +4 -2
  128. data/lib/active_support/core_ext/string/strip.rb +5 -1
  129. data/lib/active_support/core_ext/string/zones.rb +2 -0
  130. data/lib/active_support/core_ext/string.rb +2 -0
  131. data/lib/active_support/core_ext/symbol/starts_ends_with.rb +14 -0
  132. data/lib/active_support/core_ext/symbol.rb +3 -0
  133. data/lib/active_support/core_ext/time/acts_like.rb +2 -0
  134. data/lib/active_support/core_ext/time/calculations.rb +73 -18
  135. data/lib/active_support/core_ext/time/compatibility.rb +4 -2
  136. data/lib/active_support/core_ext/time/conversions.rb +4 -0
  137. data/lib/active_support/core_ext/time/zones.rb +6 -4
  138. data/lib/active_support/core_ext/time.rb +2 -0
  139. data/lib/active_support/core_ext/uri.rb +11 -6
  140. data/lib/active_support/core_ext.rb +3 -1
  141. data/lib/active_support/current_attributes/test_helper.rb +13 -0
  142. data/lib/active_support/current_attributes.rb +208 -0
  143. data/lib/active_support/dependencies/autoload.rb +2 -0
  144. data/lib/active_support/dependencies/interlock.rb +2 -0
  145. data/lib/active_support/dependencies/zeitwerk_integration.rb +117 -0
  146. data/lib/active_support/dependencies.rb +135 -60
  147. data/lib/active_support/deprecation/behaviors.rb +43 -11
  148. data/lib/active_support/deprecation/constant_accessor.rb +4 -2
  149. data/lib/active_support/deprecation/disallowed.rb +56 -0
  150. data/lib/active_support/deprecation/instance_delegator.rb +2 -1
  151. data/lib/active_support/deprecation/method_wrappers.rb +30 -15
  152. data/lib/active_support/deprecation/proxy_wrappers.rb +32 -6
  153. data/lib/active_support/deprecation/reporting.rb +54 -9
  154. data/lib/active_support/deprecation.rb +9 -2
  155. data/lib/active_support/descendants_tracker.rb +61 -9
  156. data/lib/active_support/digest.rb +20 -0
  157. data/lib/active_support/duration/iso8601_parser.rb +6 -6
  158. data/lib/active_support/duration/iso8601_serializer.rb +20 -14
  159. data/lib/active_support/duration.rb +179 -41
  160. data/lib/active_support/encrypted_configuration.rb +45 -0
  161. data/lib/active_support/encrypted_file.rb +117 -0
  162. data/lib/active_support/environment_inquirer.rb +20 -0
  163. data/lib/active_support/evented_file_update_checker.rb +84 -117
  164. data/lib/active_support/execution_wrapper.rb +3 -0
  165. data/lib/active_support/executor.rb +2 -0
  166. data/lib/active_support/file_update_checker.rb +2 -1
  167. data/lib/active_support/fork_tracker.rb +62 -0
  168. data/lib/active_support/gem_version.rb +3 -1
  169. data/lib/active_support/gzip.rb +2 -0
  170. data/lib/active_support/hash_with_indifferent_access.rb +134 -37
  171. data/lib/active_support/i18n.rb +4 -1
  172. data/lib/active_support/i18n_railtie.rb +20 -11
  173. data/lib/active_support/inflections.rb +2 -0
  174. data/lib/active_support/inflector/inflections.rb +19 -8
  175. data/lib/active_support/inflector/methods.rb +87 -77
  176. data/lib/active_support/inflector/transliterate.rb +56 -18
  177. data/lib/active_support/inflector.rb +2 -0
  178. data/lib/active_support/json/decoding.rb +27 -26
  179. data/lib/active_support/json/encoding.rb +13 -3
  180. data/lib/active_support/json.rb +2 -0
  181. data/lib/active_support/key_generator.rb +3 -33
  182. data/lib/active_support/lazy_load_hooks.rb +33 -10
  183. data/lib/active_support/locale/en.rb +33 -0
  184. data/lib/active_support/locale/en.yml +7 -3
  185. data/lib/active_support/log_subscriber/test_helper.rb +2 -0
  186. data/lib/active_support/log_subscriber.rb +46 -13
  187. data/lib/active_support/logger.rb +4 -17
  188. data/lib/active_support/logger_silence.rb +13 -20
  189. data/lib/active_support/logger_thread_safe_level.rb +54 -7
  190. data/lib/active_support/message_encryptor.rb +101 -33
  191. data/lib/active_support/message_verifier.rb +85 -14
  192. data/lib/active_support/messages/metadata.rb +80 -0
  193. data/lib/active_support/messages/rotation_configuration.rb +23 -0
  194. data/lib/active_support/messages/rotator.rb +57 -0
  195. data/lib/active_support/multibyte/chars.rb +12 -68
  196. data/lib/active_support/multibyte/unicode.rb +17 -327
  197. data/lib/active_support/multibyte.rb +2 -0
  198. data/lib/active_support/notifications/fanout.rb +118 -16
  199. data/lib/active_support/notifications/instrumenter.rb +73 -9
  200. data/lib/active_support/notifications.rb +74 -8
  201. data/lib/active_support/number_helper/number_converter.rb +7 -6
  202. data/lib/active_support/number_helper/number_to_currency_converter.rb +6 -9
  203. data/lib/active_support/number_helper/number_to_delimited_converter.rb +5 -2
  204. data/lib/active_support/number_helper/number_to_human_converter.rb +8 -7
  205. data/lib/active_support/number_helper/number_to_human_size_converter.rb +6 -3
  206. data/lib/active_support/number_helper/number_to_percentage_converter.rb +5 -1
  207. data/lib/active_support/number_helper/number_to_phone_converter.rb +5 -2
  208. data/lib/active_support/number_helper/number_to_rounded_converter.rb +16 -53
  209. data/lib/active_support/number_helper/rounding_helper.rb +50 -0
  210. data/lib/active_support/number_helper.rb +41 -12
  211. data/lib/active_support/option_merger.rb +24 -3
  212. data/lib/active_support/ordered_hash.rb +3 -1
  213. data/lib/active_support/ordered_options.rb +17 -5
  214. data/lib/active_support/parameter_filter.rb +133 -0
  215. data/lib/active_support/per_thread_registry.rb +3 -1
  216. data/lib/active_support/proxy_object.rb +2 -0
  217. data/lib/active_support/rails.rb +3 -10
  218. data/lib/active_support/railtie.rb +60 -9
  219. data/lib/active_support/reloader.rb +11 -10
  220. data/lib/active_support/rescuable.rb +7 -6
  221. data/lib/active_support/secure_compare_rotator.rb +51 -0
  222. data/lib/active_support/security_utils.rb +26 -15
  223. data/lib/active_support/string_inquirer.rb +6 -3
  224. data/lib/active_support/subscriber.rb +74 -24
  225. data/lib/active_support/tagged_logging.rb +44 -8
  226. data/lib/active_support/test_case.rb +94 -2
  227. data/lib/active_support/testing/assertions.rb +58 -20
  228. data/lib/active_support/testing/autorun.rb +2 -4
  229. data/lib/active_support/testing/constant_lookup.rb +2 -0
  230. data/lib/active_support/testing/declarative.rb +2 -0
  231. data/lib/active_support/testing/deprecation.rb +2 -1
  232. data/lib/active_support/testing/file_fixtures.rb +4 -0
  233. data/lib/active_support/testing/isolation.rb +8 -4
  234. data/lib/active_support/testing/method_call_assertions.rb +30 -1
  235. data/lib/active_support/testing/parallelization/server.rb +78 -0
  236. data/lib/active_support/testing/parallelization/worker.rb +100 -0
  237. data/lib/active_support/testing/parallelization.rb +51 -0
  238. data/lib/active_support/testing/setup_and_teardown.rb +12 -7
  239. data/lib/active_support/testing/stream.rb +3 -2
  240. data/lib/active_support/testing/tagged_logging.rb +2 -0
  241. data/lib/active_support/testing/time_helpers.rb +78 -13
  242. data/lib/active_support/time.rb +2 -0
  243. data/lib/active_support/time_with_zone.rb +113 -41
  244. data/lib/active_support/values/time_zone.rb +55 -25
  245. data/lib/active_support/version.rb +2 -0
  246. data/lib/active_support/xml_mini/jdom.rb +5 -4
  247. data/lib/active_support/xml_mini/libxml.rb +4 -2
  248. data/lib/active_support/xml_mini/libxmlsax.rb +6 -4
  249. data/lib/active_support/xml_mini/nokogiri.rb +4 -2
  250. data/lib/active_support/xml_mini/nokogirisax.rb +5 -3
  251. data/lib/active_support/xml_mini/rexml.rb +12 -3
  252. data/lib/active_support/xml_mini.rb +5 -11
  253. data/lib/active_support.rb +18 -13
  254. metadata +81 -35
  255. data/lib/active_support/core_ext/array/prepend_and_append.rb +0 -7
  256. data/lib/active_support/core_ext/hash/compact.rb +0 -27
  257. data/lib/active_support/core_ext/hash/transform_values.rb +0 -30
  258. data/lib/active_support/core_ext/kernel/agnostics.rb +0 -11
  259. data/lib/active_support/core_ext/module/reachable.rb +0 -8
  260. data/lib/active_support/core_ext/numeric/inquiry.rb +0 -26
  261. data/lib/active_support/core_ext/range/include_range.rb +0 -23
  262. data/lib/active_support/values/unicode_tables.dat +0 -0
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "active_support/core_ext/kernel/reporting"
2
4
  require "active_support/core_ext/object/blank"
3
5
  require "stringio"
@@ -6,7 +8,7 @@ module ActiveSupport
6
8
  module XmlMini_REXML #:nodoc:
7
9
  extend self
8
10
 
9
- CONTENT_KEY = "__content__".freeze
11
+ CONTENT_KEY = "__content__"
10
12
 
11
13
  # Parse an XML Document string or IO into a simple hash.
12
14
  #
@@ -23,7 +25,7 @@ module ActiveSupport
23
25
  if data.eof?
24
26
  {}
25
27
  else
26
- silence_warnings { require "rexml/document" } unless defined?(REXML::Document)
28
+ require_rexml unless defined?(REXML::Document)
27
29
  doc = REXML::Document.new(data)
28
30
 
29
31
  if doc.root
@@ -36,6 +38,13 @@ module ActiveSupport
36
38
  end
37
39
 
38
40
  private
41
+ def require_rexml
42
+ silence_warnings { require "rexml/document" }
43
+ rescue LoadError => e
44
+ $stderr.puts "You don't have rexml installed in your application. Please add it to your Gemfile and run bundle install"
45
+ raise e
46
+ end
47
+
39
48
  # Convert an XML element and merge into the hash
40
49
  #
41
50
  # hash::
@@ -74,7 +83,7 @@ module ActiveSupport
74
83
  hash
75
84
  else
76
85
  # must use value to prevent double-escaping
77
- texts = ""
86
+ texts = +""
78
87
  element.texts.each { |t| texts << t.value }
79
88
  merge!(hash, CONTENT_KEY, texts)
80
89
  end
@@ -1,6 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "time"
2
4
  require "base64"
3
5
  require "bigdecimal"
6
+ require "bigdecimal/util"
4
7
  require "active_support/core_ext/module/delegation"
5
8
  require "active_support/core_ext/string/inflections"
6
9
  require "active_support/core_ext/date_time/calculations"
@@ -46,10 +49,6 @@ module ActiveSupport
46
49
  "Array" => "array",
47
50
  "Hash" => "hash"
48
51
  }
49
-
50
- # No need to map these on Ruby 2.4+
51
- TYPE_NAMES["Fixnum"] = "integer" unless 0.class == Integer
52
- TYPE_NAMES["Bignum"] = "integer" unless 0.class == Integer
53
52
  end
54
53
 
55
54
  FORMATTING = {
@@ -70,18 +69,14 @@ module ActiveSupport
70
69
  "float" => Proc.new { |float| float.to_f },
71
70
  "decimal" => Proc.new do |number|
72
71
  if String === number
73
- begin
74
- BigDecimal(number)
75
- rescue ArgumentError
76
- BigDecimal("0")
77
- end
72
+ number.to_d
78
73
  else
79
74
  BigDecimal(number)
80
75
  end
81
76
  end,
82
77
  "boolean" => Proc.new { |boolean| %w(1 true).include?(boolean.to_s.strip) },
83
78
  "string" => Proc.new { |string| string.to_s },
84
- "yaml" => Proc.new { |yaml| YAML::load(yaml) rescue yaml },
79
+ "yaml" => Proc.new { |yaml| YAML.load(yaml) rescue yaml },
85
80
  "base64Binary" => Proc.new { |bin| ::Base64.decode64(bin) },
86
81
  "binary" => Proc.new { |bin, entity| _parse_binary(bin, entity) },
87
82
  "file" => Proc.new { |file, entity| _parse_file(file, entity) }
@@ -160,7 +155,6 @@ module ActiveSupport
160
155
  end
161
156
 
162
157
  private
163
-
164
158
  def _dasherize(key)
165
159
  # $2 must be a non-greedy regex for this to work
166
160
  left, middle, right = /\A(_*)(.*?)(_*)\Z/.match(key.strip)[1, 3]
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #--
2
- # Copyright (c) 2005-2017 David Heinemeier Hansson
4
+ # Copyright (c) 2005-2020 David Heinemeier Hansson
3
5
  #
4
6
  # Permission is hereby granted, free of charge, to any person obtaining
5
7
  # a copy of this software and associated documentation files (the
@@ -32,15 +34,20 @@ module ActiveSupport
32
34
  extend ActiveSupport::Autoload
33
35
 
34
36
  autoload :Concern
37
+ autoload :ActionableError
38
+ autoload :ConfigurationFile
39
+ autoload :CurrentAttributes
35
40
  autoload :Dependencies
36
41
  autoload :DescendantsTracker
37
42
  autoload :ExecutionWrapper
38
43
  autoload :Executor
39
44
  autoload :FileUpdateChecker
40
45
  autoload :EventedFileUpdateChecker
46
+ autoload :ForkTracker
41
47
  autoload :LogSubscriber
42
48
  autoload :Notifications
43
49
  autoload :Reloader
50
+ autoload :SecureCompareRotator
44
51
 
45
52
  eager_autoload do
46
53
  autoload :BacktraceCleaner
@@ -50,6 +57,7 @@ module ActiveSupport
50
57
  autoload :Callbacks
51
58
  autoload :Configurable
52
59
  autoload :Deprecation
60
+ autoload :Digest
53
61
  autoload :Gzip
54
62
  autoload :Inflector
55
63
  autoload :JSON
@@ -62,6 +70,7 @@ module ActiveSupport
62
70
  autoload :OrderedHash
63
71
  autoload :OrderedOptions
64
72
  autoload :StringInquirer
73
+ autoload :EnvironmentInquirer
65
74
  autoload :TaggedLogging
66
75
  autoload :XmlMini
67
76
  autoload :ArrayInquirer
@@ -79,18 +88,6 @@ module ActiveSupport
79
88
 
80
89
  cattr_accessor :test_order # :nodoc:
81
90
 
82
- def self.halt_callback_chains_on_return_false
83
- ActiveSupport::Deprecation.warn(<<-MSG.squish)
84
- ActiveSupport.halt_callback_chains_on_return_false is deprecated and will be removed in Rails 5.2.
85
- MSG
86
- end
87
-
88
- def self.halt_callback_chains_on_return_false=(value)
89
- ActiveSupport::Deprecation.warn(<<-MSG.squish)
90
- ActiveSupport.halt_callback_chains_on_return_false= is deprecated and will be removed in Rails 5.2.
91
- MSG
92
- end
93
-
94
91
  def self.to_time_preserves_timezone
95
92
  DateAndTime::Compatibility.preserve_timezone
96
93
  end
@@ -98,6 +95,14 @@ module ActiveSupport
98
95
  def self.to_time_preserves_timezone=(value)
99
96
  DateAndTime::Compatibility.preserve_timezone = value
100
97
  end
98
+
99
+ def self.utc_to_local_returns_utc_offset_times
100
+ DateAndTime::Compatibility.utc_to_local_returns_utc_offset_times
101
+ end
102
+
103
+ def self.utc_to_local_returns_utc_offset_times=(value)
104
+ DateAndTime::Compatibility.utc_to_local_returns_utc_offset_times = value
105
+ end
101
106
  end
102
107
 
103
108
  autoload :I18n, "active_support/i18n"
metadata CHANGED
@@ -1,77 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activesupport
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.1
4
+ version: 6.1.1
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: 2017-05-12 00:00:00.000000000 Z
11
+ date: 2021-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ - - "<"
18
21
  - !ruby/object:Gem::Version
19
- version: '0.7'
22
+ version: '2'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
- version: '0.7'
29
+ version: '1.6'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '2'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: tzinfo
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
37
  - - "~>"
32
38
  - !ruby/object:Gem::Version
33
- version: '1.1'
39
+ version: '2.0'
34
40
  type: :runtime
35
41
  prerelease: false
36
42
  version_requirements: !ruby/object:Gem::Requirement
37
43
  requirements:
38
44
  - - "~>"
39
45
  - !ruby/object:Gem::Version
40
- version: '1.1'
46
+ version: '2.0'
41
47
  - !ruby/object:Gem::Dependency
42
- name: minitest
48
+ name: concurrent-ruby
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
51
  - - "~>"
46
52
  - !ruby/object:Gem::Version
47
- version: '5.1'
53
+ version: '1.0'
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: 1.0.2
48
57
  type: :runtime
49
58
  prerelease: false
50
59
  version_requirements: !ruby/object:Gem::Requirement
51
60
  requirements:
52
61
  - - "~>"
53
62
  - !ruby/object:Gem::Version
54
- version: '5.1'
63
+ version: '1.0'
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: 1.0.2
55
67
  - !ruby/object:Gem::Dependency
56
- name: concurrent-ruby
68
+ name: zeitwerk
57
69
  requirement: !ruby/object:Gem::Requirement
58
70
  requirements:
59
71
  - - "~>"
60
72
  - !ruby/object:Gem::Version
61
- version: '1.0'
62
- - - ">="
63
- - !ruby/object:Gem::Version
64
- version: 1.0.2
73
+ version: '2.3'
65
74
  type: :runtime
66
75
  prerelease: false
67
76
  version_requirements: !ruby/object:Gem::Requirement
68
77
  requirements:
69
78
  - - "~>"
70
79
  - !ruby/object:Gem::Version
71
- version: '1.0'
80
+ version: '2.3'
81
+ - !ruby/object:Gem::Dependency
82
+ name: minitest
83
+ requirement: !ruby/object:Gem::Requirement
84
+ requirements:
72
85
  - - ">="
73
86
  - !ruby/object:Gem::Version
74
- version: 1.0.2
87
+ version: '5.1'
88
+ type: :runtime
89
+ prerelease: false
90
+ version_requirements: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '5.1'
75
95
  description: A toolkit of support libraries and Ruby core extensions extracted from
76
96
  the Rails framework. Rich support for multibyte strings, internationalization, time
77
97
  zones, and testing.
@@ -84,6 +104,7 @@ files:
84
104
  - MIT-LICENSE
85
105
  - README.rdoc
86
106
  - lib/active_support.rb
107
+ - lib/active_support/actionable_error.rb
87
108
  - lib/active_support/all.rb
88
109
  - lib/active_support/array_inquirer.rb
89
110
  - lib/active_support/backtrace_cleaner.rb
@@ -94,20 +115,23 @@ files:
94
115
  - lib/active_support/cache/mem_cache_store.rb
95
116
  - lib/active_support/cache/memory_store.rb
96
117
  - lib/active_support/cache/null_store.rb
118
+ - lib/active_support/cache/redis_cache_store.rb
97
119
  - lib/active_support/cache/strategy/local_cache.rb
98
120
  - lib/active_support/cache/strategy/local_cache_middleware.rb
99
121
  - lib/active_support/callbacks.rb
100
122
  - lib/active_support/concern.rb
123
+ - lib/active_support/concurrency/load_interlock_aware_monitor.rb
101
124
  - lib/active_support/concurrency/share_lock.rb
102
125
  - lib/active_support/configurable.rb
126
+ - lib/active_support/configuration_file.rb
103
127
  - lib/active_support/core_ext.rb
104
128
  - lib/active_support/core_ext/array.rb
105
129
  - lib/active_support/core_ext/array/access.rb
106
130
  - lib/active_support/core_ext/array/conversions.rb
131
+ - lib/active_support/core_ext/array/extract.rb
107
132
  - lib/active_support/core_ext/array/extract_options.rb
108
133
  - lib/active_support/core_ext/array/grouping.rb
109
134
  - lib/active_support/core_ext/array/inquiry.rb
110
- - lib/active_support/core_ext/array/prepend_and_append.rb
111
135
  - lib/active_support/core_ext/array/wrap.rb
112
136
  - lib/active_support/core_ext/benchmark.rb
113
137
  - lib/active_support/core_ext/big_decimal.rb
@@ -131,26 +155,25 @@ files:
131
155
  - lib/active_support/core_ext/date_time/calculations.rb
132
156
  - lib/active_support/core_ext/date_time/compatibility.rb
133
157
  - lib/active_support/core_ext/date_time/conversions.rb
158
+ - lib/active_support/core_ext/digest.rb
134
159
  - lib/active_support/core_ext/digest/uuid.rb
135
160
  - lib/active_support/core_ext/enumerable.rb
136
161
  - lib/active_support/core_ext/file.rb
137
162
  - lib/active_support/core_ext/file/atomic.rb
138
163
  - lib/active_support/core_ext/hash.rb
139
- - lib/active_support/core_ext/hash/compact.rb
140
164
  - lib/active_support/core_ext/hash/conversions.rb
141
165
  - lib/active_support/core_ext/hash/deep_merge.rb
166
+ - lib/active_support/core_ext/hash/deep_transform_values.rb
142
167
  - lib/active_support/core_ext/hash/except.rb
143
168
  - lib/active_support/core_ext/hash/indifferent_access.rb
144
169
  - lib/active_support/core_ext/hash/keys.rb
145
170
  - lib/active_support/core_ext/hash/reverse_merge.rb
146
171
  - lib/active_support/core_ext/hash/slice.rb
147
- - lib/active_support/core_ext/hash/transform_values.rb
148
172
  - lib/active_support/core_ext/integer.rb
149
173
  - lib/active_support/core_ext/integer/inflections.rb
150
174
  - lib/active_support/core_ext/integer/multiple.rb
151
175
  - lib/active_support/core_ext/integer/time.rb
152
176
  - lib/active_support/core_ext/kernel.rb
153
- - lib/active_support/core_ext/kernel/agnostics.rb
154
177
  - lib/active_support/core_ext/kernel/concern.rb
155
178
  - lib/active_support/core_ext/kernel/reporting.rb
156
179
  - lib/active_support/core_ext/kernel/singleton_class.rb
@@ -166,13 +189,12 @@ files:
166
189
  - lib/active_support/core_ext/module/delegation.rb
167
190
  - lib/active_support/core_ext/module/deprecation.rb
168
191
  - lib/active_support/core_ext/module/introspection.rb
169
- - lib/active_support/core_ext/module/reachable.rb
192
+ - lib/active_support/core_ext/module/redefine_method.rb
170
193
  - lib/active_support/core_ext/module/remove_method.rb
171
194
  - lib/active_support/core_ext/name_error.rb
172
195
  - lib/active_support/core_ext/numeric.rb
173
196
  - lib/active_support/core_ext/numeric/bytes.rb
174
197
  - lib/active_support/core_ext/numeric/conversions.rb
175
- - lib/active_support/core_ext/numeric/inquiry.rb
176
198
  - lib/active_support/core_ext/numeric/time.rb
177
199
  - lib/active_support/core_ext/object.rb
178
200
  - lib/active_support/core_ext/object/acts_like.rb
@@ -188,9 +210,10 @@ files:
188
210
  - lib/active_support/core_ext/object/try.rb
189
211
  - lib/active_support/core_ext/object/with_options.rb
190
212
  - lib/active_support/core_ext/range.rb
213
+ - lib/active_support/core_ext/range/compare_range.rb
191
214
  - lib/active_support/core_ext/range/conversions.rb
192
215
  - lib/active_support/core_ext/range/each.rb
193
- - lib/active_support/core_ext/range/include_range.rb
216
+ - lib/active_support/core_ext/range/include_time_with_zone.rb
194
217
  - lib/active_support/core_ext/range/overlaps.rb
195
218
  - lib/active_support/core_ext/regexp.rb
196
219
  - lib/active_support/core_ext/securerandom.rb
@@ -208,6 +231,8 @@ files:
208
231
  - lib/active_support/core_ext/string/starts_ends_with.rb
209
232
  - lib/active_support/core_ext/string/strip.rb
210
233
  - lib/active_support/core_ext/string/zones.rb
234
+ - lib/active_support/core_ext/symbol.rb
235
+ - lib/active_support/core_ext/symbol/starts_ends_with.rb
211
236
  - lib/active_support/core_ext/time.rb
212
237
  - lib/active_support/core_ext/time/acts_like.rb
213
238
  - lib/active_support/core_ext/time/calculations.rb
@@ -215,24 +240,33 @@ files:
215
240
  - lib/active_support/core_ext/time/conversions.rb
216
241
  - lib/active_support/core_ext/time/zones.rb
217
242
  - lib/active_support/core_ext/uri.rb
243
+ - lib/active_support/current_attributes.rb
244
+ - lib/active_support/current_attributes/test_helper.rb
218
245
  - lib/active_support/dependencies.rb
219
246
  - lib/active_support/dependencies/autoload.rb
220
247
  - lib/active_support/dependencies/interlock.rb
248
+ - lib/active_support/dependencies/zeitwerk_integration.rb
221
249
  - lib/active_support/deprecation.rb
222
250
  - lib/active_support/deprecation/behaviors.rb
223
251
  - lib/active_support/deprecation/constant_accessor.rb
252
+ - lib/active_support/deprecation/disallowed.rb
224
253
  - lib/active_support/deprecation/instance_delegator.rb
225
254
  - lib/active_support/deprecation/method_wrappers.rb
226
255
  - lib/active_support/deprecation/proxy_wrappers.rb
227
256
  - lib/active_support/deprecation/reporting.rb
228
257
  - lib/active_support/descendants_tracker.rb
258
+ - lib/active_support/digest.rb
229
259
  - lib/active_support/duration.rb
230
260
  - lib/active_support/duration/iso8601_parser.rb
231
261
  - lib/active_support/duration/iso8601_serializer.rb
262
+ - lib/active_support/encrypted_configuration.rb
263
+ - lib/active_support/encrypted_file.rb
264
+ - lib/active_support/environment_inquirer.rb
232
265
  - lib/active_support/evented_file_update_checker.rb
233
266
  - lib/active_support/execution_wrapper.rb
234
267
  - lib/active_support/executor.rb
235
268
  - lib/active_support/file_update_checker.rb
269
+ - lib/active_support/fork_tracker.rb
236
270
  - lib/active_support/gem_version.rb
237
271
  - lib/active_support/gzip.rb
238
272
  - lib/active_support/hash_with_indifferent_access.rb
@@ -248,6 +282,7 @@ files:
248
282
  - lib/active_support/json/encoding.rb
249
283
  - lib/active_support/key_generator.rb
250
284
  - lib/active_support/lazy_load_hooks.rb
285
+ - lib/active_support/locale/en.rb
251
286
  - lib/active_support/locale/en.yml
252
287
  - lib/active_support/log_subscriber.rb
253
288
  - lib/active_support/log_subscriber/test_helper.rb
@@ -256,6 +291,9 @@ files:
256
291
  - lib/active_support/logger_thread_safe_level.rb
257
292
  - lib/active_support/message_encryptor.rb
258
293
  - lib/active_support/message_verifier.rb
294
+ - lib/active_support/messages/metadata.rb
295
+ - lib/active_support/messages/rotation_configuration.rb
296
+ - lib/active_support/messages/rotator.rb
259
297
  - lib/active_support/multibyte.rb
260
298
  - lib/active_support/multibyte/chars.rb
261
299
  - lib/active_support/multibyte/unicode.rb
@@ -271,15 +309,18 @@ files:
271
309
  - lib/active_support/number_helper/number_to_percentage_converter.rb
272
310
  - lib/active_support/number_helper/number_to_phone_converter.rb
273
311
  - lib/active_support/number_helper/number_to_rounded_converter.rb
312
+ - lib/active_support/number_helper/rounding_helper.rb
274
313
  - lib/active_support/option_merger.rb
275
314
  - lib/active_support/ordered_hash.rb
276
315
  - lib/active_support/ordered_options.rb
316
+ - lib/active_support/parameter_filter.rb
277
317
  - lib/active_support/per_thread_registry.rb
278
318
  - lib/active_support/proxy_object.rb
279
319
  - lib/active_support/rails.rb
280
320
  - lib/active_support/railtie.rb
281
321
  - lib/active_support/reloader.rb
282
322
  - lib/active_support/rescuable.rb
323
+ - lib/active_support/secure_compare_rotator.rb
283
324
  - lib/active_support/security_utils.rb
284
325
  - lib/active_support/string_inquirer.rb
285
326
  - lib/active_support/subscriber.rb
@@ -293,6 +334,9 @@ files:
293
334
  - lib/active_support/testing/file_fixtures.rb
294
335
  - lib/active_support/testing/isolation.rb
295
336
  - lib/active_support/testing/method_call_assertions.rb
337
+ - lib/active_support/testing/parallelization.rb
338
+ - lib/active_support/testing/parallelization/server.rb
339
+ - lib/active_support/testing/parallelization/worker.rb
296
340
  - lib/active_support/testing/setup_and_teardown.rb
297
341
  - lib/active_support/testing/stream.rb
298
342
  - lib/active_support/testing/tagged_logging.rb
@@ -300,7 +344,6 @@ files:
300
344
  - lib/active_support/time.rb
301
345
  - lib/active_support/time_with_zone.rb
302
346
  - lib/active_support/values/time_zone.rb
303
- - lib/active_support/values/unicode_tables.dat
304
347
  - lib/active_support/version.rb
305
348
  - lib/active_support/xml_mini.rb
306
349
  - lib/active_support/xml_mini/jdom.rb
@@ -309,11 +352,16 @@ files:
309
352
  - lib/active_support/xml_mini/nokogiri.rb
310
353
  - lib/active_support/xml_mini/nokogirisax.rb
311
354
  - lib/active_support/xml_mini/rexml.rb
312
- homepage: http://rubyonrails.org
355
+ homepage: https://rubyonrails.org
313
356
  licenses:
314
357
  - MIT
315
- metadata: {}
316
- post_install_message:
358
+ metadata:
359
+ bug_tracker_uri: https://github.com/rails/rails/issues
360
+ changelog_uri: https://github.com/rails/rails/blob/v6.1.1/activesupport/CHANGELOG.md
361
+ documentation_uri: https://api.rubyonrails.org/v6.1.1/
362
+ mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
363
+ source_code_uri: https://github.com/rails/rails/tree/v6.1.1/activesupport
364
+ post_install_message:
317
365
  rdoc_options:
318
366
  - "--encoding"
319
367
  - UTF-8
@@ -323,18 +371,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
323
371
  requirements:
324
372
  - - ">="
325
373
  - !ruby/object:Gem::Version
326
- version: 2.2.2
374
+ version: 2.5.0
327
375
  required_rubygems_version: !ruby/object:Gem::Requirement
328
376
  requirements:
329
377
  - - ">="
330
378
  - !ruby/object:Gem::Version
331
379
  version: '0'
332
380
  requirements: []
333
- rubyforge_project:
334
- rubygems_version: 2.6.10
335
- signing_key:
381
+ rubygems_version: 3.2.3
382
+ signing_key:
336
383
  specification_version: 4
337
384
  summary: A toolkit of support libraries and Ruby core extensions extracted from the
338
385
  Rails framework.
339
386
  test_files: []
340
- has_rdoc:
@@ -1,7 +0,0 @@
1
- class Array
2
- # The human way of thinking about adding stuff to the end of a list is with append.
3
- alias_method :append, :<<
4
-
5
- # The human way of thinking about adding stuff to the beginning of a list is with prepend.
6
- alias_method :prepend, :unshift
7
- end
@@ -1,27 +0,0 @@
1
- class Hash
2
- unless Hash.instance_methods(false).include?(:compact)
3
- # Returns a hash with non +nil+ values.
4
- #
5
- # hash = { a: true, b: false, c: nil }
6
- # hash.compact # => { a: true, b: false }
7
- # hash # => { a: true, b: false, c: nil }
8
- # { c: nil }.compact # => {}
9
- # { c: true }.compact # => { c: true }
10
- def compact
11
- select { |_, value| !value.nil? }
12
- end
13
- end
14
-
15
- unless Hash.instance_methods(false).include?(:compact!)
16
- # Replaces current hash with non +nil+ values.
17
- # Returns +nil+ if no changes were made, otherwise returns the hash.
18
- #
19
- # hash = { a: true, b: false, c: nil }
20
- # hash.compact! # => { a: true, b: false }
21
- # hash # => { a: true, b: false }
22
- # { c: true }.compact! # => nil
23
- def compact!
24
- reject! { |_, value| value.nil? }
25
- end
26
- end
27
- end
@@ -1,30 +0,0 @@
1
- class Hash
2
- # Returns a new hash with the results of running +block+ once for every value.
3
- # The keys are unchanged.
4
- #
5
- # { a: 1, b: 2, c: 3 }.transform_values { |x| x * 2 } # => { a: 2, b: 4, c: 6 }
6
- #
7
- # If you do not provide a +block+, it will return an Enumerator
8
- # for chaining with other methods:
9
- #
10
- # { a: 1, b: 2 }.transform_values.with_index { |v, i| [v, i].join.to_i } # => { a: 10, b: 21 }
11
- def transform_values
12
- return enum_for(:transform_values) { size } unless block_given?
13
- return {} if empty?
14
- result = self.class.new
15
- each do |key, value|
16
- result[key] = yield(value)
17
- end
18
- result
19
- end unless method_defined? :transform_values
20
-
21
- # Destructively converts all values using the +block+ operations.
22
- # Same as +transform_values+ but modifies +self+.
23
- def transform_values!
24
- return enum_for(:transform_values!) { size } unless block_given?
25
- each do |key, value|
26
- self[key] = yield(value)
27
- end
28
- end unless method_defined? :transform_values!
29
- # TODO: Remove this file when supporting only Ruby 2.4+.
30
- end
@@ -1,11 +0,0 @@
1
- class Object
2
- # Makes backticks behave (somewhat more) similarly on all platforms.
3
- # On win32 `nonexistent_command` raises Errno::ENOENT; on Unix, the
4
- # spawned shell prints a message to stderr and sets $?. We emulate
5
- # Unix on the former but not the latter.
6
- def `(command) #:nodoc:
7
- super
8
- rescue Errno::ENOENT => e
9
- STDERR.puts "#$0: #{e}"
10
- end
11
- end
@@ -1,8 +0,0 @@
1
- require "active_support/core_ext/module/anonymous"
2
- require "active_support/core_ext/string/inflections"
3
-
4
- class Module
5
- def reachable? #:nodoc:
6
- !anonymous? && name.safe_constantize.equal?(self)
7
- end
8
- end
@@ -1,26 +0,0 @@
1
- unless 1.respond_to?(:positive?) # TODO: Remove this file when we drop support to ruby < 2.3
2
- class Numeric
3
- # Returns true if the number is positive.
4
- #
5
- # 1.positive? # => true
6
- # 0.positive? # => false
7
- # -1.positive? # => false
8
- def positive?
9
- self > 0
10
- end
11
-
12
- # Returns true if the number is negative.
13
- #
14
- # -1.negative? # => true
15
- # 0.negative? # => false
16
- # 1.negative? # => false
17
- def negative?
18
- self < 0
19
- end
20
- end
21
-
22
- class Complex
23
- undef :positive?
24
- undef :negative?
25
- end
26
- end
@@ -1,23 +0,0 @@
1
- module ActiveSupport
2
- module IncludeWithRange #:nodoc:
3
- # Extends the default Range#include? to support range comparisons.
4
- # (1..5).include?(1..5) # => true
5
- # (1..5).include?(2..3) # => true
6
- # (1..5).include?(2..6) # => false
7
- #
8
- # The native Range#include? behavior is untouched.
9
- # ('a'..'f').include?('c') # => true
10
- # (5..9).include?(11) # => false
11
- def include?(value)
12
- if value.is_a?(::Range)
13
- # 1...10 includes 1..9 but it does not include 1..10.
14
- operator = exclude_end? && !value.exclude_end? ? :< : :<=
15
- super(value.first) && value.last.send(operator, last)
16
- else
17
- super
18
- end
19
- end
20
- end
21
- end
22
-
23
- Range.prepend(ActiveSupport::IncludeWithRange)