activesupport 1.2.4 → 8.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (309) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +505 -0
  3. data/MIT-LICENSE +20 -0
  4. data/README.rdoc +40 -0
  5. data/lib/active_support/actionable_error.rb +50 -0
  6. data/lib/active_support/all.rb +5 -0
  7. data/lib/active_support/array_inquirer.rb +50 -0
  8. data/lib/active_support/backtrace_cleaner.rb +234 -0
  9. data/lib/active_support/benchmark.rb +21 -0
  10. data/lib/active_support/benchmarkable.rb +53 -0
  11. data/lib/active_support/broadcast_logger.rb +238 -0
  12. data/lib/active_support/builder.rb +8 -0
  13. data/lib/active_support/cache/coder.rb +153 -0
  14. data/lib/active_support/cache/entry.rb +134 -0
  15. data/lib/active_support/cache/file_store.rb +244 -0
  16. data/lib/active_support/cache/mem_cache_store.rb +288 -0
  17. data/lib/active_support/cache/memory_store.rb +264 -0
  18. data/lib/active_support/cache/null_store.rb +62 -0
  19. data/lib/active_support/cache/redis_cache_store.rb +498 -0
  20. data/lib/active_support/cache/serializer_with_fallback.rb +152 -0
  21. data/lib/active_support/cache/strategy/local_cache.rb +246 -0
  22. data/lib/active_support/cache/strategy/local_cache_middleware.rb +45 -0
  23. data/lib/active_support/cache.rb +1170 -0
  24. data/lib/active_support/callbacks.rb +960 -0
  25. data/lib/active_support/class_attribute.rb +33 -0
  26. data/lib/active_support/code_generator.rb +79 -0
  27. data/lib/active_support/concern.rb +217 -0
  28. data/lib/active_support/concurrency/load_interlock_aware_monitor.rb +18 -0
  29. data/lib/active_support/concurrency/null_lock.rb +13 -0
  30. data/lib/active_support/concurrency/share_lock.rb +225 -0
  31. data/lib/active_support/concurrency/thread_monitor.rb +55 -0
  32. data/lib/active_support/configurable.rb +193 -0
  33. data/lib/active_support/configuration_file.rb +60 -0
  34. data/lib/active_support/continuous_integration.rb +145 -0
  35. data/lib/active_support/core_ext/array/access.rb +100 -0
  36. data/lib/active_support/core_ext/array/conversions.rb +209 -26
  37. data/lib/active_support/core_ext/array/extract.rb +21 -0
  38. data/lib/active_support/core_ext/array/extract_options.rb +31 -0
  39. data/lib/active_support/core_ext/array/grouping.rb +109 -0
  40. data/lib/active_support/core_ext/array/inquiry.rb +19 -0
  41. data/lib/active_support/core_ext/array/wrap.rb +48 -0
  42. data/lib/active_support/core_ext/array.rb +8 -4
  43. data/lib/active_support/core_ext/benchmark.rb +6 -0
  44. data/lib/active_support/core_ext/big_decimal/conversions.rb +14 -0
  45. data/lib/active_support/core_ext/big_decimal.rb +3 -0
  46. data/lib/active_support/core_ext/class/attribute.rb +137 -0
  47. data/lib/active_support/core_ext/class/attribute_accessors.rb +6 -0
  48. data/lib/active_support/core_ext/class/subclasses.rb +24 -0
  49. data/lib/active_support/core_ext/class.rb +4 -0
  50. data/lib/active_support/core_ext/date/acts_like.rb +10 -0
  51. data/lib/active_support/core_ext/date/blank.rb +18 -0
  52. data/lib/active_support/core_ext/date/calculations.rb +161 -0
  53. data/lib/active_support/core_ext/date/conversions.rb +95 -28
  54. data/lib/active_support/core_ext/date/zones.rb +8 -0
  55. data/lib/active_support/core_ext/date.rb +6 -5
  56. data/lib/active_support/core_ext/date_and_time/calculations.rb +374 -0
  57. data/lib/active_support/core_ext/date_and_time/compatibility.rb +23 -0
  58. data/lib/active_support/core_ext/date_and_time/zones.rb +40 -0
  59. data/lib/active_support/core_ext/date_time/acts_like.rb +16 -0
  60. data/lib/active_support/core_ext/date_time/blank.rb +18 -0
  61. data/lib/active_support/core_ext/date_time/calculations.rb +215 -0
  62. data/lib/active_support/core_ext/date_time/compatibility.rb +16 -0
  63. data/lib/active_support/core_ext/date_time/conversions.rb +108 -0
  64. data/lib/active_support/core_ext/date_time.rb +7 -0
  65. data/lib/active_support/core_ext/digest/uuid.rb +76 -0
  66. data/lib/active_support/core_ext/digest.rb +3 -0
  67. data/lib/active_support/core_ext/enumerable.rb +277 -7
  68. data/lib/active_support/core_ext/erb/util.rb +201 -0
  69. data/lib/active_support/core_ext/file/atomic.rb +72 -0
  70. data/lib/active_support/core_ext/file.rb +3 -0
  71. data/lib/active_support/core_ext/hash/conversions.rb +262 -0
  72. data/lib/active_support/core_ext/hash/deep_merge.rb +43 -0
  73. data/lib/active_support/core_ext/hash/deep_transform_values.rb +46 -0
  74. data/lib/active_support/core_ext/hash/except.rb +12 -0
  75. data/lib/active_support/core_ext/hash/indifferent_access.rb +19 -55
  76. data/lib/active_support/core_ext/hash/keys.rb +134 -44
  77. data/lib/active_support/core_ext/hash/reverse_merge.rb +22 -22
  78. data/lib/active_support/core_ext/hash/slice.rb +27 -0
  79. data/lib/active_support/core_ext/hash.rb +9 -8
  80. data/lib/active_support/core_ext/integer/inflections.rb +29 -13
  81. data/lib/active_support/core_ext/integer/multiple.rb +12 -0
  82. data/lib/active_support/core_ext/integer/time.rb +22 -0
  83. data/lib/active_support/core_ext/integer.rb +4 -6
  84. data/lib/active_support/core_ext/kernel/concern.rb +14 -0
  85. data/lib/active_support/core_ext/kernel/reporting.rb +45 -0
  86. data/lib/active_support/core_ext/kernel/singleton_class.rb +8 -0
  87. data/lib/active_support/core_ext/kernel.rb +4 -78
  88. data/lib/active_support/core_ext/load_error.rb +6 -35
  89. data/lib/active_support/core_ext/module/aliasing.rb +31 -0
  90. data/lib/active_support/core_ext/module/anonymous.rb +30 -0
  91. data/lib/active_support/core_ext/module/attr_internal.rb +48 -0
  92. data/lib/active_support/core_ext/module/attribute_accessors.rb +214 -0
  93. data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +175 -0
  94. data/lib/active_support/core_ext/module/concerning.rb +140 -0
  95. data/lib/active_support/core_ext/module/delegation.rb +225 -0
  96. data/lib/active_support/core_ext/module/deprecation.rb +25 -0
  97. data/lib/active_support/core_ext/module/introspection.rb +65 -0
  98. data/lib/active_support/core_ext/module/redefine_method.rb +40 -0
  99. data/lib/active_support/core_ext/module/remove_method.rb +17 -0
  100. data/lib/active_support/core_ext/module.rb +13 -0
  101. data/lib/active_support/core_ext/name_error.rb +59 -0
  102. data/lib/active_support/core_ext/numeric/bytes.rb +73 -42
  103. data/lib/active_support/core_ext/numeric/conversions.rb +145 -0
  104. data/lib/active_support/core_ext/numeric/time.rb +64 -57
  105. data/lib/active_support/core_ext/numeric.rb +4 -6
  106. data/lib/active_support/core_ext/object/acts_like.rb +45 -0
  107. data/lib/active_support/core_ext/object/blank.rb +199 -0
  108. data/lib/active_support/core_ext/object/conversions.rb +6 -0
  109. data/lib/active_support/core_ext/object/deep_dup.rb +71 -0
  110. data/lib/active_support/core_ext/object/duplicable.rb +69 -0
  111. data/lib/active_support/core_ext/object/inclusion.rb +37 -0
  112. data/lib/active_support/core_ext/object/instance_variables.rb +32 -0
  113. data/lib/active_support/core_ext/object/json.rb +267 -0
  114. data/lib/active_support/core_ext/object/to_param.rb +3 -0
  115. data/lib/active_support/core_ext/object/to_query.rb +93 -0
  116. data/lib/active_support/core_ext/object/try.rb +158 -0
  117. data/lib/active_support/core_ext/object/with.rb +46 -0
  118. data/lib/active_support/core_ext/object/with_options.rb +101 -0
  119. data/lib/active_support/core_ext/object.rb +17 -0
  120. data/lib/active_support/core_ext/pathname/blank.rb +20 -0
  121. data/lib/active_support/core_ext/pathname/existence.rb +23 -0
  122. data/lib/active_support/core_ext/pathname.rb +4 -0
  123. data/lib/active_support/core_ext/range/compare_range.rb +57 -0
  124. data/lib/active_support/core_ext/range/conversions.rb +58 -17
  125. data/lib/active_support/core_ext/range/overlap.rb +40 -0
  126. data/lib/active_support/core_ext/range/sole.rb +17 -0
  127. data/lib/active_support/core_ext/range.rb +5 -4
  128. data/lib/active_support/core_ext/regexp.rb +14 -0
  129. data/lib/active_support/core_ext/securerandom.rb +57 -0
  130. data/lib/active_support/core_ext/string/access.rb +93 -56
  131. data/lib/active_support/core_ext/string/behavior.rb +8 -0
  132. data/lib/active_support/core_ext/string/conversions.rb +57 -16
  133. data/lib/active_support/core_ext/string/exclude.rb +13 -0
  134. data/lib/active_support/core_ext/string/filters.rb +151 -0
  135. data/lib/active_support/core_ext/string/indent.rb +45 -0
  136. data/lib/active_support/core_ext/string/inflections.rb +297 -54
  137. data/lib/active_support/core_ext/string/inquiry.rb +16 -0
  138. data/lib/active_support/core_ext/string/multibyte.rb +67 -0
  139. data/lib/active_support/core_ext/string/output_safety.rb +235 -0
  140. data/lib/active_support/core_ext/string/starts_ends_with.rb +4 -18
  141. data/lib/active_support/core_ext/string/strip.rb +27 -0
  142. data/lib/active_support/core_ext/string/zones.rb +16 -0
  143. data/lib/active_support/core_ext/string.rb +14 -10
  144. data/lib/active_support/core_ext/symbol/starts_ends_with.rb +6 -0
  145. data/lib/active_support/core_ext/symbol.rb +3 -0
  146. data/lib/active_support/core_ext/thread/backtrace/location.rb +7 -0
  147. data/lib/active_support/core_ext/time/acts_like.rb +10 -0
  148. data/lib/active_support/core_ext/time/calculations.rb +358 -153
  149. data/lib/active_support/core_ext/time/compatibility.rb +15 -0
  150. data/lib/active_support/core_ext/time/conversions.rb +69 -30
  151. data/lib/active_support/core_ext/time/zones.rb +97 -0
  152. data/lib/active_support/core_ext/time.rb +6 -6
  153. data/lib/active_support/core_ext.rb +5 -1
  154. data/lib/active_support/current_attributes/test_helper.rb +13 -0
  155. data/lib/active_support/current_attributes.rb +243 -0
  156. data/lib/active_support/deep_mergeable.rb +53 -0
  157. data/lib/active_support/delegation.rb +183 -0
  158. data/lib/active_support/dependencies/autoload.rb +72 -0
  159. data/lib/active_support/dependencies/interlock.rb +55 -0
  160. data/lib/active_support/dependencies/require_dependency.rb +28 -0
  161. data/lib/active_support/dependencies.rb +84 -222
  162. data/lib/active_support/deprecation/behaviors.rb +148 -0
  163. data/lib/active_support/deprecation/constant_accessor.rb +74 -0
  164. data/lib/active_support/deprecation/deprecators.rb +104 -0
  165. data/lib/active_support/deprecation/disallowed.rb +54 -0
  166. data/lib/active_support/deprecation/method_wrappers.rb +68 -0
  167. data/lib/active_support/deprecation/proxy_wrappers.rb +189 -0
  168. data/lib/active_support/deprecation/reporting.rb +162 -0
  169. data/lib/active_support/deprecation.rb +81 -0
  170. data/lib/active_support/deprecator.rb +7 -0
  171. data/lib/active_support/descendants_tracker.rb +112 -0
  172. data/lib/active_support/digest.rb +22 -0
  173. data/lib/active_support/duration/iso8601_parser.rb +123 -0
  174. data/lib/active_support/duration/iso8601_serializer.rb +64 -0
  175. data/lib/active_support/duration.rb +524 -0
  176. data/lib/active_support/editor.rb +70 -0
  177. data/lib/active_support/encrypted_configuration.rb +126 -0
  178. data/lib/active_support/encrypted_file.rb +133 -0
  179. data/lib/active_support/environment_inquirer.rb +40 -0
  180. data/lib/active_support/error_reporter/test_helper.rb +15 -0
  181. data/lib/active_support/error_reporter.rb +318 -0
  182. data/lib/active_support/event_reporter/test_helper.rb +32 -0
  183. data/lib/active_support/event_reporter.rb +592 -0
  184. data/lib/active_support/evented_file_update_checker.rb +185 -0
  185. data/lib/active_support/execution_context/test_helper.rb +13 -0
  186. data/lib/active_support/execution_context.rb +110 -0
  187. data/lib/active_support/execution_wrapper.rb +150 -0
  188. data/lib/active_support/executor/test_helper.rb +7 -0
  189. data/lib/active_support/executor.rb +8 -0
  190. data/lib/active_support/file_update_checker.rb +166 -0
  191. data/lib/active_support/fork_tracker.rb +43 -0
  192. data/lib/active_support/gem_version.rb +17 -0
  193. data/lib/active_support/gzip.rb +41 -0
  194. data/lib/active_support/hash_with_indifferent_access.rb +464 -0
  195. data/lib/active_support/html_safe_translation.rb +56 -0
  196. data/lib/active_support/i18n.rb +17 -0
  197. data/lib/active_support/i18n_railtie.rb +140 -0
  198. data/lib/active_support/inflections.rb +68 -49
  199. data/lib/active_support/inflector/inflections.rb +290 -0
  200. data/lib/active_support/inflector/methods.rb +387 -0
  201. data/lib/active_support/inflector/transliterate.rb +147 -0
  202. data/lib/active_support/inflector.rb +7 -164
  203. data/lib/active_support/isolated_execution_state.rb +76 -0
  204. data/lib/active_support/json/decoding.rb +78 -0
  205. data/lib/active_support/json/encoding.rb +256 -0
  206. data/lib/active_support/json.rb +4 -0
  207. data/lib/active_support/key_generator.rb +66 -0
  208. data/lib/active_support/lazy_load_hooks.rb +107 -0
  209. data/lib/active_support/locale/en.rb +33 -0
  210. data/lib/active_support/locale/en.yml +141 -0
  211. data/lib/active_support/log_subscriber/test_helper.rb +106 -0
  212. data/lib/active_support/log_subscriber.rb +188 -0
  213. data/lib/active_support/logger.rb +55 -0
  214. data/lib/active_support/logger_silence.rb +21 -0
  215. data/lib/active_support/logger_thread_safe_level.rb +50 -0
  216. data/lib/active_support/message_encryptor.rb +374 -0
  217. data/lib/active_support/message_encryptors.rb +193 -0
  218. data/lib/active_support/message_pack/cache_serializer.rb +23 -0
  219. data/lib/active_support/message_pack/extensions.rb +310 -0
  220. data/lib/active_support/message_pack/serializer.rb +63 -0
  221. data/lib/active_support/message_pack.rb +50 -0
  222. data/lib/active_support/message_verifier.rb +377 -0
  223. data/lib/active_support/message_verifiers.rb +189 -0
  224. data/lib/active_support/messages/codec.rb +65 -0
  225. data/lib/active_support/messages/metadata.rb +146 -0
  226. data/lib/active_support/messages/rotation_configuration.rb +23 -0
  227. data/lib/active_support/messages/rotation_coordinator.rb +102 -0
  228. data/lib/active_support/messages/rotator.rb +69 -0
  229. data/lib/active_support/messages/serializer_with_fallback.rb +158 -0
  230. data/lib/active_support/multibyte/chars.rb +188 -0
  231. data/lib/active_support/multibyte/unicode.rb +42 -0
  232. data/lib/active_support/multibyte.rb +27 -0
  233. data/lib/active_support/notifications/fanout.rb +467 -0
  234. data/lib/active_support/notifications/instrumenter.rb +240 -0
  235. data/lib/active_support/notifications.rb +281 -0
  236. data/lib/active_support/number_helper/number_converter.rb +190 -0
  237. data/lib/active_support/number_helper/number_to_currency_converter.rb +46 -0
  238. data/lib/active_support/number_helper/number_to_delimited_converter.rb +30 -0
  239. data/lib/active_support/number_helper/number_to_human_converter.rb +69 -0
  240. data/lib/active_support/number_helper/number_to_human_size_converter.rb +60 -0
  241. data/lib/active_support/number_helper/number_to_percentage_converter.rb +16 -0
  242. data/lib/active_support/number_helper/number_to_phone_converter.rb +60 -0
  243. data/lib/active_support/number_helper/number_to_rounded_converter.rb +59 -0
  244. data/lib/active_support/number_helper/rounding_helper.rb +46 -0
  245. data/lib/active_support/number_helper.rb +479 -0
  246. data/lib/active_support/option_merger.rb +38 -0
  247. data/lib/active_support/ordered_hash.rb +50 -0
  248. data/lib/active_support/ordered_options.rb +141 -25
  249. data/lib/active_support/parameter_filter.rb +157 -0
  250. data/lib/active_support/rails.rb +26 -0
  251. data/lib/active_support/railtie.rb +180 -0
  252. data/lib/active_support/reloader.rb +138 -0
  253. data/lib/active_support/rescuable.rb +176 -0
  254. data/lib/active_support/secure_compare_rotator.rb +58 -0
  255. data/lib/active_support/security_utils.rb +38 -0
  256. data/lib/active_support/string_inquirer.rb +35 -0
  257. data/lib/active_support/structured_event_subscriber.rb +99 -0
  258. data/lib/active_support/subscriber.rb +141 -0
  259. data/lib/active_support/syntax_error_proxy.rb +67 -0
  260. data/lib/active_support/tagged_logging.rb +157 -0
  261. data/lib/active_support/test_case.rb +365 -0
  262. data/lib/active_support/testing/assertions.rb +369 -0
  263. data/lib/active_support/testing/autorun.rb +10 -0
  264. data/lib/active_support/testing/constant_lookup.rb +51 -0
  265. data/lib/active_support/testing/constant_stubbing.rb +54 -0
  266. data/lib/active_support/testing/declarative.rb +28 -0
  267. data/lib/active_support/testing/deprecation.rb +82 -0
  268. data/lib/active_support/testing/error_reporter_assertions.rb +124 -0
  269. data/lib/active_support/testing/event_reporter_assertions.rb +227 -0
  270. data/lib/active_support/testing/file_fixtures.rb +38 -0
  271. data/lib/active_support/testing/isolation.rb +121 -0
  272. data/lib/active_support/testing/method_call_assertions.rb +69 -0
  273. data/lib/active_support/testing/notification_assertions.rb +92 -0
  274. data/lib/active_support/testing/parallelization/server.rb +98 -0
  275. data/lib/active_support/testing/parallelization/worker.rb +107 -0
  276. data/lib/active_support/testing/parallelization.rb +79 -0
  277. data/lib/active_support/testing/parallelize_executor.rb +81 -0
  278. data/lib/active_support/testing/setup_and_teardown.rb +57 -0
  279. data/lib/active_support/testing/stream.rb +41 -0
  280. data/lib/active_support/testing/tagged_logging.rb +27 -0
  281. data/lib/active_support/testing/tests_without_assertions.rb +19 -0
  282. data/lib/active_support/testing/time_helpers.rb +273 -0
  283. data/lib/active_support/time.rb +20 -0
  284. data/lib/active_support/time_with_zone.rb +613 -0
  285. data/lib/active_support/values/time_zone.rb +599 -158
  286. data/lib/active_support/version.rb +7 -6
  287. data/lib/active_support/xml_mini/jdom.rb +175 -0
  288. data/lib/active_support/xml_mini/libxml.rb +80 -0
  289. data/lib/active_support/xml_mini/libxmlsax.rb +83 -0
  290. data/lib/active_support/xml_mini/nokogiri.rb +83 -0
  291. data/lib/active_support/xml_mini/nokogirisax.rb +86 -0
  292. data/lib/active_support/xml_mini/rexml.rb +137 -0
  293. data/lib/active_support/xml_mini.rb +212 -0
  294. data/lib/active_support.rb +122 -10
  295. metadata +524 -93
  296. data/CHANGELOG +0 -283
  297. data/lib/active_support/binding_of_caller.rb +0 -84
  298. data/lib/active_support/breakpoint.rb +0 -523
  299. data/lib/active_support/class_attribute_accessors.rb +0 -57
  300. data/lib/active_support/class_inheritable_attributes.rb +0 -117
  301. data/lib/active_support/clean_logger.rb +0 -36
  302. data/lib/active_support/core_ext/blank.rb +0 -38
  303. data/lib/active_support/core_ext/cgi/escape_skipping_slashes.rb +0 -14
  304. data/lib/active_support/core_ext/cgi.rb +0 -5
  305. data/lib/active_support/core_ext/exception.rb +0 -29
  306. data/lib/active_support/core_ext/integer/even_odd.rb +0 -24
  307. data/lib/active_support/core_ext/object_and_class.rb +0 -44
  308. data/lib/active_support/module_attribute_accessors.rb +0 -57
  309. data/lib/active_support/whiny_nil.rb +0 -38
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 9c47955c56ff0cd5b61a8b4d74383c8f2f7523146088f2f1f7181049c354920c
4
+ data.tar.gz: a42c08e02aa40dafbaf38a7aff2b2d12dbb32c262bef95e10071381179aec53b
5
+ SHA512:
6
+ metadata.gz: 83cfdbf2e2542e39fcfbe2918d6f50eca40e3ab713176f4a0ba2085272b642596632fa13704dd5fd37ba97f8d1ec1848d4821ad6d17d3330095f1576b8c1059f
7
+ data.tar.gz: 1c8b04fd7508ae125f30d5317437258ca35b02f6092562a81aa26bd6eaccb386684367e7bc6273128c7aa9ca036451694c8c67af3784f6e68fdf4a584c5fcdcc
data/CHANGELOG.md ADDED
@@ -0,0 +1,505 @@
1
+ ## Rails 8.1.2 (January 08, 2026) ##
2
+
3
+ * Make `delegate` and `delegate_missing_to` work in BasicObject subclasses.
4
+
5
+ *Rafael Mendonça França*
6
+
7
+ * Fix Inflectors when using a locale that fallbacks to `:en`.
8
+
9
+ *Said Kaldybaev*
10
+
11
+ * Fix `ActiveSupport::TimeWithZone#as_json` to consistently return UTF-8 strings.
12
+
13
+ Previously the returned string would sometime be encoded in US-ASCII, which in
14
+ some cases may be problematic.
15
+
16
+ Now the method consistently always return UTF-8 strings.
17
+
18
+ *Jean Boussier*
19
+
20
+ * Fix `TimeWithZone#xmlschema` when wrapping a `DateTime` instance in local time.
21
+
22
+ Previously it would return an invalid time.
23
+
24
+ *Dmytro Rymar*
25
+
26
+ * Implement LocalCache strategy on `ActiveSupport::Cache::MemoryStore`. The memory store
27
+ needs to respond to the same interface as other cache stores (e.g. `ActiveSupport::NullStore`).
28
+
29
+ *Mikey Gough*
30
+
31
+ * Fix `ActiveSupport::Inflector.humanize` with international characters.
32
+
33
+ ```ruby
34
+ ActiveSupport::Inflector.humanize("áÉÍÓÚ") # => "Áéíóú"
35
+ ActiveSupport::Inflector.humanize("аБВГДЕ") # => "Абвгде"
36
+ ```
37
+
38
+ *Jose Luis Duran*
39
+
40
+
41
+ ## Rails 8.1.1 (October 28, 2025) ##
42
+
43
+ * No changes.
44
+
45
+
46
+ ## Rails 8.1.0 (October 22, 2025) ##
47
+
48
+ * Remove deprecated passing a Time object to `Time#since`.
49
+
50
+ *Rafael Mendonça França*
51
+
52
+ * Remove deprecated `Benchmark.ms` method. It is now defined in the `benchmark` gem.
53
+
54
+ *Rafael Mendonça França*
55
+
56
+ * Remove deprecated addition for `Time` instances with `ActiveSupport::TimeWithZone`.
57
+
58
+ *Rafael Mendonça França*
59
+
60
+ * Remove deprecated support for `to_time` to preserve the system local time. It will now always preserve the receiver
61
+ timezone.
62
+
63
+ *Rafael Mendonça França*
64
+
65
+ * Deprecate `config.active_support.to_time_preserves_timezone`.
66
+
67
+ *Rafael Mendonça França*
68
+
69
+ * Standardize event name formatting in `assert_event_reported` error messages.
70
+
71
+ The event name in failure messages now uses `.inspect` (e.g., `name: "user.created"`)
72
+ to match `assert_events_reported` and provide type clarity between strings and symbols.
73
+ This only affects tests that assert on the failure message format itself.
74
+
75
+ *George Ma*
76
+
77
+ * Fix `Enumerable#sole` to return the full tuple instead of just the first element of the tuple.
78
+
79
+ *Olivier Bellone*
80
+
81
+ * Fix parallel tests hanging when worker processes die abruptly.
82
+
83
+ Previously, if a worker process was killed (e.g., OOM killed, `kill -9`) during parallel
84
+ test execution, the test suite would hang forever waiting for the dead worker.
85
+
86
+ *Joshua Young*
87
+
88
+ * Add `config.active_support.escape_js_separators_in_json`.
89
+
90
+ Introduce a new framework default to skip escaping LINE SEPARATOR (U+2028) and PARAGRAPH SEPARATOR (U+2029) in JSON.
91
+
92
+ Historically these characters were not valid inside JavaScript literal strings but that changed in ECMAScript 2019.
93
+ As such it's no longer a concern in modern browsers: https://caniuse.com/mdn-javascript_builtins_json_json_superset.
94
+
95
+ *Étienne Barrié*, *Jean Boussier*
96
+
97
+ * Fix `NameError` when `class_attribute` is defined on instance singleton classes.
98
+
99
+ Previously, calling `class_attribute` on an instance's singleton class would raise
100
+ a `NameError` when accessing the attribute through the instance.
101
+
102
+ ```ruby
103
+ object = MyClass.new
104
+ object.singleton_class.class_attribute :foo, default: "bar"
105
+ object.foo # previously raised NameError, now returns "bar"
106
+ ```
107
+
108
+ *Joshua Young*
109
+
110
+ * Introduce `ActiveSupport::Testing::EventReporterAssertions#with_debug_event_reporting`
111
+ to enable event reporter debug mode in tests.
112
+
113
+ The previous way to enable debug mode is by using `#with_debug` on the
114
+ event reporter itself, which is too verbose. This new helper will help
115
+ clear up any confusion on how to test debug events.
116
+
117
+ *Gannon McGibbon*
118
+
119
+ * Add `ActiveSupport::StructuredEventSubscriber` for consuming notifications and
120
+ emitting structured event logs. Events may be emitted with the `#emit_event`
121
+ or `#emit_debug_event` methods.
122
+
123
+ ```ruby
124
+ class MyStructuredEventSubscriber < ActiveSupport::StructuredEventSubscriber
125
+ def notification(event)
126
+ emit_event("my.notification", data: 1)
127
+ end
128
+ end
129
+ ```
130
+
131
+ *Adrianna Chang*
132
+
133
+ * `ActiveSupport::FileUpdateChecker` does not depend on `Time.now` to prevent unecessary reloads with time travel test helpers
134
+
135
+ *Jan Grodowski*
136
+
137
+ * Add `ActiveSupport::Cache::Store#namespace=` and `#namespace`.
138
+
139
+ Can be used as an alternative to `Store#clear` in some situations such as parallel
140
+ testing.
141
+
142
+ *Nick Schwaderer*
143
+
144
+ * Create `parallel_worker_id` helper for running parallel tests. This allows users to
145
+ know which worker they are currently running in.
146
+
147
+ *Nick Schwaderer*
148
+
149
+ * Make the cache of `ActiveSupport::Cache::Strategy::LocalCache::Middleware` updatable.
150
+
151
+ If the cache client at `Rails.cache` of a booted application changes, the corresponding
152
+ mounted middleware needs to update in order for request-local caches to be setup properly.
153
+ Otherwise, redundant cache operations will erroneously hit the datastore.
154
+
155
+ *Gannon McGibbon*
156
+
157
+ * Add `assert_events_reported` test helper for `ActiveSupport::EventReporter`.
158
+
159
+ This new assertion allows testing multiple events in a single block, regardless of order:
160
+
161
+ ```ruby
162
+ assert_events_reported([
163
+ { name: "user.created", payload: { id: 123 } },
164
+ { name: "email.sent", payload: { to: "user@example.com" } }
165
+ ]) do
166
+ create_user_and_send_welcome_email
167
+ end
168
+ ```
169
+
170
+ *George Ma*
171
+
172
+ * Add `ActiveSupport::TimeZone#standard_name` method.
173
+
174
+ ``` ruby
175
+ zone = ActiveSupport::TimeZone['Hawaii']
176
+ # Old way
177
+ ActiveSupport::TimeZone::MAPPING[zone.name]
178
+ # New way
179
+ zone.standard_name # => 'Pacific/Honolulu'
180
+ ```
181
+
182
+ *Bogdan Gusiev*
183
+
184
+ * Add Structured Event Reporter, accessible via `Rails.event`.
185
+
186
+ The Event Reporter provides a unified interface for producing structured events in Rails
187
+ applications:
188
+
189
+ ```ruby
190
+ Rails.event.notify("user.signup", user_id: 123, email: "user@example.com")
191
+ ```
192
+
193
+ It supports adding tags to events:
194
+
195
+ ```ruby
196
+ Rails.event.tagged("graphql") do
197
+ # Event includes tags: { graphql: true }
198
+ Rails.event.notify("user.signup", user_id: 123, email: "user@example.com")
199
+ end
200
+ ```
201
+
202
+ As well as context:
203
+ ```ruby
204
+ # All events will contain context: {request_id: "abc123", shop_id: 456}
205
+ Rails.event.set_context(request_id: "abc123", shop_id: 456)
206
+ ```
207
+
208
+ Events are emitted to subscribers. Applications register subscribers to
209
+ control how events are serialized and emitted. Subscribers must implement
210
+ an `#emit` method, which receives the event hash:
211
+
212
+ ```ruby
213
+ class LogSubscriber
214
+ def emit(event)
215
+ payload = event[:payload].map { |key, value| "#{key}=#{value}" }.join(" ")
216
+ source_location = event[:source_location]
217
+ log = "[#{event[:name]}] #{payload} at #{source_location[:filepath]}:#{source_location[:lineno]}"
218
+ Rails.logger.info(log)
219
+ end
220
+ end
221
+ ```
222
+
223
+ *Adrianna Chang*
224
+
225
+ * Make `ActiveSupport::Logger` `#freeze`-friendly.
226
+
227
+ *Joshua Young*
228
+
229
+ * Make `ActiveSupport::Gzip.compress` deterministic based on input.
230
+
231
+ `ActiveSupport::Gzip.compress` used to include a timestamp in the output,
232
+ causing consecutive calls with the same input data to have different output
233
+ if called during different seconds. It now always sets the timestamp to `0`
234
+ so that the output is identical for any given input.
235
+
236
+ *Rob Brackett*
237
+
238
+ * Given an array of `Thread::Backtrace::Location` objects, the new method
239
+ `ActiveSupport::BacktraceCleaner#clean_locations` returns an array with the
240
+ clean ones:
241
+
242
+ ```ruby
243
+ clean_locations = backtrace_cleaner.clean_locations(caller_locations)
244
+ ```
245
+
246
+ Filters and silencers receive strings as usual. However, the `path`
247
+ attributes of the locations in the returned array are the original,
248
+ unfiltered ones, since locations are immutable.
249
+
250
+ *Xavier Noria*
251
+
252
+ * Improve `CurrentAttributes` and `ExecutionContext` state managment in test cases.
253
+
254
+ Previously these two global state would be entirely cleared out whenever calling
255
+ into code that is wrapped by the Rails executor, typically Action Controller or
256
+ Active Job helpers:
257
+
258
+ ```ruby
259
+ test "#index works" do
260
+ CurrentUser.id = 42
261
+ get :index
262
+ CurrentUser.id == nil
263
+ end
264
+ ```
265
+
266
+ Now re-entering the executor properly save and restore that state.
267
+
268
+ *Jean Boussier*
269
+
270
+ * The new method `ActiveSupport::BacktraceCleaner#first_clean_location`
271
+ returns the first clean location of the caller's call stack, or `nil`.
272
+ Locations are `Thread::Backtrace::Location` objects. Useful when you want to
273
+ report the application-level location where something happened as an object.
274
+
275
+ *Xavier Noria*
276
+
277
+ * FileUpdateChecker and EventedFileUpdateChecker ignore changes in Gem.path now.
278
+
279
+ *Ermolaev Andrey*, *zzak*
280
+
281
+ * The new method `ActiveSupport::BacktraceCleaner#first_clean_frame` returns
282
+ the first clean frame of the caller's backtrace, or `nil`. Useful when you
283
+ want to report the application-level frame where something happened as a
284
+ string.
285
+
286
+ *Xavier Noria*
287
+
288
+ * Always clear `CurrentAttributes` instances.
289
+
290
+ Previously `CurrentAttributes` instance would be reset at the end of requests.
291
+ Meaning its attributes would be re-initialized.
292
+
293
+ This is problematic because it assume these objects don't hold any state
294
+ other than their declared attribute, which isn't always the case, and
295
+ can lead to state leak across request.
296
+
297
+ Now `CurrentAttributes` instances are abandoned at the end of a request,
298
+ and a new instance is created at the start of the next request.
299
+
300
+ *Jean Boussier*, *Janko Marohnić*
301
+
302
+ * Add public API for `before_fork_hook` in parallel testing.
303
+
304
+ Introduces a public API for calling the before fork hooks implemented by parallel testing.
305
+
306
+ ```ruby
307
+ parallelize_before_fork do
308
+ # perform an action before test processes are forked
309
+ end
310
+ ```
311
+
312
+ *Eileen M. Uchitelle*
313
+
314
+ * Implement ability to skip creating parallel testing databases.
315
+
316
+ With parallel testing, Rails will create a database per process. If this isn't
317
+ desirable or you would like to implement databases handling on your own, you can
318
+ now turn off this default behavior.
319
+
320
+ To skip creating a database per process, you can change it via the
321
+ `parallelize` method:
322
+
323
+ ```ruby
324
+ parallelize(workers: 10, parallelize_databases: false)
325
+ ```
326
+
327
+ or via the application configuration:
328
+
329
+ ```ruby
330
+ config.active_support.parallelize_databases = false
331
+ ```
332
+
333
+ *Eileen M. Uchitelle*
334
+
335
+ * Allow to configure maximum cache key sizes
336
+
337
+ When the key exceeds the configured limit (250 bytes by default), it will be truncated and
338
+ the digest of the rest of the key appended to it.
339
+
340
+ Note that previously `ActiveSupport::Cache::RedisCacheStore` allowed up to 1kb cache keys before
341
+ truncation, which is now reduced to 250 bytes.
342
+
343
+ ```ruby
344
+ config.cache_store = :redis_cache_store, { max_key_size: 64 }
345
+ ```
346
+
347
+ *fatkodima*
348
+
349
+ * Use `UNLINK` command instead of `DEL` in `ActiveSupport::Cache::RedisCacheStore` for non-blocking deletion.
350
+
351
+ *Aron Roh*
352
+
353
+ * Add `Cache#read_counter` and `Cache#write_counter`
354
+
355
+ ```ruby
356
+ Rails.cache.write_counter("foo", 1)
357
+ Rails.cache.read_counter("foo") # => 1
358
+ Rails.cache.increment("foo")
359
+ Rails.cache.read_counter("foo") # => 2
360
+ ```
361
+
362
+ *Alex Ghiculescu*
363
+
364
+ * Introduce ActiveSupport::Testing::ErrorReporterAssertions#capture_error_reports
365
+
366
+ Captures all reported errors from within the block that match the given
367
+ error class.
368
+
369
+ ```ruby
370
+ reports = capture_error_reports(IOError) do
371
+ Rails.error.report(IOError.new("Oops"))
372
+ Rails.error.report(IOError.new("Oh no"))
373
+ Rails.error.report(StandardError.new)
374
+ end
375
+
376
+ assert_equal 2, reports.size
377
+ assert_equal "Oops", reports.first.error.message
378
+ assert_equal "Oh no", reports.last.error.message
379
+ ```
380
+
381
+ *Andrew Novoselac*
382
+
383
+ * Introduce ActiveSupport::ErrorReporter#add_middleware
384
+
385
+ When reporting an error, the error context middleware will be called with the reported error
386
+ and base execution context. The stack may mutate the context hash. The mutated context will
387
+ then be passed to error subscribers. Middleware receives the same parameters as `ErrorReporter#report`.
388
+
389
+ *Andrew Novoselac*, *Sam Schmidt*
390
+
391
+ * Change execution wrapping to report all exceptions, including `Exception`.
392
+
393
+ If a more serious error like `SystemStackError` or `NoMemoryError` happens,
394
+ the error reporter should be able to report these kinds of exceptions.
395
+
396
+ *Gannon McGibbon*
397
+
398
+ * `ActiveSupport::Testing::Parallelization.before_fork_hook` allows declaration of callbacks that
399
+ are invoked immediately before forking test workers.
400
+
401
+ *Mike Dalessio*
402
+
403
+ * Allow the `#freeze_time` testing helper to accept a date or time argument.
404
+
405
+ ```ruby
406
+ Time.current # => Sun, 09 Jul 2024 15:34:49 EST -05:00
407
+ freeze_time Time.current + 1.day
408
+ sleep 1
409
+ Time.current # => Mon, 10 Jul 2024 15:34:49 EST -05:00
410
+ ```
411
+
412
+ *Joshua Young*
413
+
414
+ * `ActiveSupport::JSON` now accepts options
415
+
416
+ It is now possible to pass options to `ActiveSupport::JSON`:
417
+ ```ruby
418
+ ActiveSupport::JSON.decode('{"key": "value"}', symbolize_names: true) # => { key: "value" }
419
+ ```
420
+
421
+ *matthaigh27*
422
+
423
+ * `ActiveSupport::Testing::NotificationAssertions`'s `assert_notification` now matches against payload subsets by default.
424
+
425
+ Previously the following assertion would fail due to excess key vals in the notification payload. Now with payload subset matching, it will pass.
426
+
427
+ ```ruby
428
+ assert_notification("post.submitted", title: "Cool Post") do
429
+ ActiveSupport::Notifications.instrument("post.submitted", title: "Cool Post", body: "Cool Body")
430
+ end
431
+ ```
432
+
433
+ Additionally, you can now persist a matched notification for more customized assertions.
434
+
435
+ ```ruby
436
+ notification = assert_notification("post.submitted", title: "Cool Post") do
437
+ ActiveSupport::Notifications.instrument("post.submitted", title: "Cool Post", body: Body.new("Cool Body"))
438
+ end
439
+
440
+ assert_instance_of(Body, notification.payload[:body])
441
+ ```
442
+
443
+ *Nicholas La Roux*
444
+
445
+ * Deprecate `String#mb_chars` and `ActiveSupport::Multibyte::Chars`.
446
+
447
+ These APIs are a relic of the Ruby 1.8 days when Ruby strings weren't encoding
448
+ aware. There is no legitimate reasons to need these APIs today.
449
+
450
+ *Jean Boussier*
451
+
452
+ * Deprecate `ActiveSupport::Configurable`
453
+
454
+ *Sean Doyle*
455
+
456
+ * `nil.to_query("key")` now returns `key`.
457
+
458
+ Previously it would return `key=`, preventing round tripping with `Rack::Utils.parse_nested_query`.
459
+
460
+ *Erol Fornoles*
461
+
462
+ * Avoid wrapping redis in a `ConnectionPool` when using `ActiveSupport::Cache::RedisCacheStore` if the `:redis`
463
+ option is already a `ConnectionPool`.
464
+
465
+ *Joshua Young*
466
+
467
+ * Alter `ERB::Util.tokenize` to return :PLAIN token with full input string when string doesn't contain ERB tags.
468
+
469
+ *Martin Emde*
470
+
471
+ * Fix a bug in `ERB::Util.tokenize` that causes incorrect tokenization when ERB tags are preceded by multibyte characters.
472
+
473
+ *Martin Emde*
474
+
475
+ * Add `ActiveSupport::Testing::NotificationAssertions` module to help with testing `ActiveSupport::Notifications`.
476
+
477
+ *Nicholas La Roux*, *Yishu See*, *Sean Doyle*
478
+
479
+ * `ActiveSupport::CurrentAttributes#attributes` now will return a new hash object on each call.
480
+
481
+ Previously, the same hash object was returned each time that method was called.
482
+
483
+ *fatkodima*
484
+
485
+ * `ActiveSupport::JSON.encode` supports CIDR notation.
486
+
487
+ Previously:
488
+
489
+ ```ruby
490
+ ActiveSupport::JSON.encode(IPAddr.new("172.16.0.0/24")) # => "\"172.16.0.0\""
491
+ ```
492
+
493
+ After this change:
494
+
495
+ ```ruby
496
+ ActiveSupport::JSON.encode(IPAddr.new("172.16.0.0/24")) # => "\"172.16.0.0/24\""
497
+ ```
498
+
499
+ *Taketo Takashima*
500
+
501
+ * Make `ActiveSupport::FileUpdateChecker` faster when checking many file-extensions.
502
+
503
+ *Jonathan del Strother*
504
+
505
+ Please check [8-0-stable](https://github.com/rails/rails/blob/8-0-stable/activesupport/CHANGELOG.md) for previous changes.
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) David Heinemeier Hansson
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,40 @@
1
+ = Active Support -- Utility classes and Ruby extensions from \Rails
2
+
3
+ Active Support is a collection of utility classes and standard library
4
+ extensions that were found useful for the \Rails framework. These additions
5
+ reside in this package so they can be loaded as needed in Ruby projects
6
+ outside of \Rails.
7
+
8
+ You can read more about the extensions in the {Active Support Core Extensions}[https://guides.rubyonrails.org/active_support_core_extensions.html] guide.
9
+
10
+ == Download and installation
11
+
12
+ The latest version of Active Support can be installed with RubyGems:
13
+
14
+ $ gem install activesupport
15
+
16
+ Source code can be downloaded as part of the \Rails project on GitHub:
17
+
18
+ * https://github.com/rails/rails/tree/main/activesupport
19
+
20
+
21
+ == License
22
+
23
+ Active Support is released under the MIT license:
24
+
25
+ * https://opensource.org/licenses/MIT
26
+
27
+
28
+ == Support
29
+
30
+ API documentation is at:
31
+
32
+ * https://api.rubyonrails.org
33
+
34
+ Bug reports for the Ruby on \Rails project can be filed here:
35
+
36
+ * https://github.com/rails/rails/issues
37
+
38
+ Feature requests should be discussed on the rubyonrails-core forum here:
39
+
40
+ * https://discuss.rubyonrails.org/c/rubyonrails-core
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActiveSupport
4
+ # = Actionable Errors
5
+ #
6
+ # Actionable errors lets you define actions to resolve an error.
7
+ #
8
+ # To make an error actionable, include the +ActiveSupport::ActionableError+
9
+ # module and invoke the +action+ class macro to define the action. An action
10
+ # needs a name and a block to execute.
11
+ module ActionableError
12
+ extend Concern
13
+
14
+ class NonActionable < StandardError; end
15
+
16
+ included do
17
+ class_attribute :_actions, default: {}
18
+ end
19
+
20
+ def self.actions(error) # :nodoc:
21
+ case error
22
+ when ActionableError, -> it { Class === it && it < ActionableError }
23
+ error._actions
24
+ else
25
+ {}
26
+ end
27
+ end
28
+
29
+ def self.dispatch(error, name) # :nodoc:
30
+ actions(error).fetch(name).call
31
+ rescue KeyError
32
+ raise NonActionable, "Cannot find action \"#{name}\""
33
+ end
34
+
35
+ module ClassMethods
36
+ # Defines an action that can resolve the error.
37
+ #
38
+ # class PendingMigrationError < MigrationError
39
+ # include ActiveSupport::ActionableError
40
+ #
41
+ # action "Run pending migrations" do
42
+ # ActiveRecord::Tasks::DatabaseTasks.migrate
43
+ # end
44
+ # end
45
+ def action(name, &block)
46
+ _actions[name] = block
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "active_support"
4
+ require "active_support/time"
5
+ require "active_support/core_ext"
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActiveSupport
4
+ # = \Array Inquirer
5
+ #
6
+ # Wrapping an array in an +ArrayInquirer+ gives a friendlier way to check
7
+ # its string-like contents:
8
+ #
9
+ # variants = ActiveSupport::ArrayInquirer.new([:phone, :tablet])
10
+ #
11
+ # variants.phone? # => true
12
+ # variants.tablet? # => true
13
+ # variants.desktop? # => false
14
+ class ArrayInquirer < Array
15
+ # Passes each element of +candidates+ collection to ArrayInquirer collection.
16
+ # The method returns true if any element from the ArrayInquirer collection
17
+ # is equal to the stringified or symbolized form of any element in the +candidates+ collection.
18
+ #
19
+ # If +candidates+ collection is not given, method returns true.
20
+ #
21
+ # variants = ActiveSupport::ArrayInquirer.new([:phone, :tablet])
22
+ #
23
+ # variants.any? # => true
24
+ # variants.any?(:phone, :tablet) # => true
25
+ # variants.any?('phone', 'desktop') # => true
26
+ # variants.any?(:desktop, :watch) # => false
27
+ def any?(*candidates)
28
+ if candidates.none?
29
+ super
30
+ else
31
+ candidates.any? do |candidate|
32
+ include?(candidate.to_sym) || include?(candidate.to_s)
33
+ end
34
+ end
35
+ end
36
+
37
+ private
38
+ def respond_to_missing?(name, include_private = false)
39
+ name.end_with?("?") || super
40
+ end
41
+
42
+ def method_missing(name, ...)
43
+ if name.end_with?("?")
44
+ any?(name[0..-2])
45
+ else
46
+ super
47
+ end
48
+ end
49
+ end
50
+ end