activesupport 5.0.7.2 → 5.1.0.beta1

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 (210) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +215 -820
  3. data/MIT-LICENSE +1 -1
  4. data/README.rdoc +1 -1
  5. data/lib/active_support.rb +8 -4
  6. data/lib/active_support/all.rb +3 -3
  7. data/lib/active_support/array_inquirer.rb +7 -5
  8. data/lib/active_support/backtrace_cleaner.rb +4 -4
  9. data/lib/active_support/benchmarkable.rb +3 -3
  10. data/lib/active_support/builder.rb +1 -1
  11. data/lib/active_support/cache.rb +42 -49
  12. data/lib/active_support/cache/file_store.rb +12 -21
  13. data/lib/active_support/cache/mem_cache_store.rb +30 -40
  14. data/lib/active_support/cache/memory_store.rb +11 -13
  15. data/lib/active_support/cache/null_store.rb +4 -4
  16. data/lib/active_support/cache/strategy/local_cache.rb +16 -25
  17. data/lib/active_support/cache/strategy/local_cache_middleware.rb +8 -9
  18. data/lib/active_support/callbacks.rb +647 -584
  19. data/lib/active_support/concurrency/share_lock.rb +20 -21
  20. data/lib/active_support/configurable.rb +5 -5
  21. data/lib/active_support/core_ext.rb +1 -2
  22. data/lib/active_support/core_ext/array.rb +7 -7
  23. data/lib/active_support/core_ext/array/access.rb +1 -1
  24. data/lib/active_support/core_ext/array/conversions.rb +15 -15
  25. data/lib/active_support/core_ext/array/grouping.rb +1 -1
  26. data/lib/active_support/core_ext/array/inquiry.rb +1 -1
  27. data/lib/active_support/core_ext/array/prepend_and_append.rb +1 -1
  28. data/lib/active_support/core_ext/benchmark.rb +1 -1
  29. data/lib/active_support/core_ext/big_decimal.rb +1 -1
  30. data/lib/active_support/core_ext/big_decimal/conversions.rb +4 -6
  31. data/lib/active_support/core_ext/class.rb +2 -2
  32. data/lib/active_support/core_ext/class/attribute.rb +5 -5
  33. data/lib/active_support/core_ext/class/attribute_accessors.rb +1 -1
  34. data/lib/active_support/core_ext/class/subclasses.rb +18 -4
  35. data/lib/active_support/core_ext/date.rb +5 -5
  36. data/lib/active_support/core_ext/date/acts_like.rb +1 -1
  37. data/lib/active_support/core_ext/date/blank.rb +1 -1
  38. data/lib/active_support/core_ext/date/calculations.rb +8 -8
  39. data/lib/active_support/core_ext/date/conversions.rb +12 -12
  40. data/lib/active_support/core_ext/date/zones.rb +2 -2
  41. data/lib/active_support/core_ext/date_and_time/calculations.rb +27 -22
  42. data/lib/active_support/core_ext/date_and_time/compatibility.rb +9 -1
  43. data/lib/active_support/core_ext/date_and_time/zones.rb +7 -8
  44. data/lib/active_support/core_ext/date_time.rb +5 -5
  45. data/lib/active_support/core_ext/date_time/acts_like.rb +2 -2
  46. data/lib/active_support/core_ext/date_time/blank.rb +1 -1
  47. data/lib/active_support/core_ext/date_time/calculations.rb +9 -9
  48. data/lib/active_support/core_ext/date_time/compatibility.rb +2 -13
  49. data/lib/active_support/core_ext/date_time/conversions.rb +12 -12
  50. data/lib/active_support/core_ext/digest/uuid.rb +4 -4
  51. data/lib/active_support/core_ext/enumerable.rb +46 -57
  52. data/lib/active_support/core_ext/file.rb +1 -1
  53. data/lib/active_support/core_ext/file/atomic.rb +4 -4
  54. data/lib/active_support/core_ext/hash.rb +9 -9
  55. data/lib/active_support/core_ext/hash/compact.rb +12 -9
  56. data/lib/active_support/core_ext/hash/conversions.rb +36 -37
  57. data/lib/active_support/core_ext/hash/indifferent_access.rb +1 -2
  58. data/lib/active_support/core_ext/hash/keys.rb +8 -8
  59. data/lib/active_support/core_ext/hash/reverse_merge.rb +1 -1
  60. data/lib/active_support/core_ext/hash/slice.rb +4 -4
  61. data/lib/active_support/core_ext/hash/transform_values.rb +1 -0
  62. data/lib/active_support/core_ext/integer.rb +3 -3
  63. data/lib/active_support/core_ext/integer/inflections.rb +1 -1
  64. data/lib/active_support/core_ext/integer/time.rb +2 -2
  65. data/lib/active_support/core_ext/kernel.rb +4 -4
  66. data/lib/active_support/core_ext/kernel/concern.rb +1 -1
  67. data/lib/active_support/core_ext/kernel/reporting.rb +1 -1
  68. data/lib/active_support/core_ext/load_error.rb +1 -18
  69. data/lib/active_support/core_ext/marshal.rb +2 -2
  70. data/lib/active_support/core_ext/module.rb +11 -12
  71. data/lib/active_support/core_ext/module/aliasing.rb +3 -48
  72. data/lib/active_support/core_ext/module/attr_internal.rb +4 -4
  73. data/lib/active_support/core_ext/module/attribute_accessors.rb +11 -5
  74. data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +20 -13
  75. data/lib/active_support/core_ext/module/concerning.rb +1 -1
  76. data/lib/active_support/core_ext/module/delegation.rb +82 -16
  77. data/lib/active_support/core_ext/module/introspection.rb +3 -11
  78. data/lib/active_support/core_ext/module/reachable.rb +2 -2
  79. data/lib/active_support/core_ext/numeric.rb +4 -4
  80. data/lib/active_support/core_ext/numeric/conversions.rb +3 -9
  81. data/lib/active_support/core_ext/numeric/inquiry.rb +21 -21
  82. data/lib/active_support/core_ext/numeric/time.rb +5 -5
  83. data/lib/active_support/core_ext/object.rb +12 -12
  84. data/lib/active_support/core_ext/object/blank.rb +3 -1
  85. data/lib/active_support/core_ext/object/conversions.rb +4 -4
  86. data/lib/active_support/core_ext/object/deep_dup.rb +1 -1
  87. data/lib/active_support/core_ext/object/duplicable.rb +24 -4
  88. data/lib/active_support/core_ext/object/inclusion.rb +1 -1
  89. data/lib/active_support/core_ext/object/json.rb +26 -12
  90. data/lib/active_support/core_ext/object/to_param.rb +1 -1
  91. data/lib/active_support/core_ext/object/to_query.rb +4 -4
  92. data/lib/active_support/core_ext/object/try.rb +1 -1
  93. data/lib/active_support/core_ext/object/with_options.rb +1 -1
  94. data/lib/active_support/core_ext/range.rb +4 -4
  95. data/lib/active_support/core_ext/range/conversions.rb +1 -1
  96. data/lib/active_support/core_ext/regexp.rb +4 -0
  97. data/lib/active_support/core_ext/securerandom.rb +3 -3
  98. data/lib/active_support/core_ext/string.rb +13 -13
  99. data/lib/active_support/core_ext/string/access.rb +6 -6
  100. data/lib/active_support/core_ext/string/conversions.rb +2 -2
  101. data/lib/active_support/core_ext/string/filters.rb +3 -3
  102. data/lib/active_support/core_ext/string/indent.rb +4 -4
  103. data/lib/active_support/core_ext/string/inflections.rb +10 -14
  104. data/lib/active_support/core_ext/string/inquiry.rb +1 -1
  105. data/lib/active_support/core_ext/string/multibyte.rb +1 -1
  106. data/lib/active_support/core_ext/string/output_safety.rb +19 -20
  107. data/lib/active_support/core_ext/string/strip.rb +1 -1
  108. data/lib/active_support/core_ext/string/zones.rb +2 -2
  109. data/lib/active_support/core_ext/time.rb +5 -5
  110. data/lib/active_support/core_ext/time/acts_like.rb +1 -1
  111. data/lib/active_support/core_ext/time/calculations.rb +23 -29
  112. data/lib/active_support/core_ext/time/compatibility.rb +1 -10
  113. data/lib/active_support/core_ext/time/conversions.rb +12 -12
  114. data/lib/active_support/core_ext/time/zones.rb +3 -3
  115. data/lib/active_support/core_ext/uri.rb +2 -2
  116. data/lib/active_support/dependencies.rb +45 -47
  117. data/lib/active_support/dependencies/interlock.rb +1 -1
  118. data/lib/active_support/deprecation.rb +8 -8
  119. data/lib/active_support/deprecation/behaviors.rb +3 -3
  120. data/lib/active_support/deprecation/instance_delegator.rb +2 -2
  121. data/lib/active_support/deprecation/method_wrappers.rb +3 -3
  122. data/lib/active_support/deprecation/proxy_wrappers.rb +6 -4
  123. data/lib/active_support/deprecation/reporting.rb +7 -7
  124. data/lib/active_support/duration.rb +30 -26
  125. data/lib/active_support/duration/iso8601_parser.rb +66 -65
  126. data/lib/active_support/duration/iso8601_serializer.rb +11 -9
  127. data/lib/active_support/evented_file_update_checker.rb +59 -60
  128. data/lib/active_support/execution_wrapper.rb +3 -3
  129. data/lib/active_support/executor.rb +1 -1
  130. data/lib/active_support/file_update_checker.rb +54 -50
  131. data/lib/active_support/gem_version.rb +3 -3
  132. data/lib/active_support/gzip.rb +5 -5
  133. data/lib/active_support/hash_with_indifferent_access.rb +10 -20
  134. data/lib/active_support/i18n.rb +5 -5
  135. data/lib/active_support/i18n_railtie.rb +11 -10
  136. data/lib/active_support/inflections.rb +11 -11
  137. data/lib/active_support/inflector.rb +5 -5
  138. data/lib/active_support/inflector/inflections.rb +11 -9
  139. data/lib/active_support/inflector/methods.rb +51 -50
  140. data/lib/active_support/inflector/transliterate.rb +8 -11
  141. data/lib/active_support/json.rb +2 -2
  142. data/lib/active_support/json/decoding.rb +3 -3
  143. data/lib/active_support/json/encoding.rb +8 -7
  144. data/lib/active_support/key_generator.rb +17 -17
  145. data/lib/active_support/lazy_load_hooks.rb +12 -30
  146. data/lib/active_support/log_subscriber.rb +5 -5
  147. data/lib/active_support/log_subscriber/test_helper.rb +9 -9
  148. data/lib/active_support/logger.rb +3 -3
  149. data/lib/active_support/logger_silence.rb +3 -3
  150. data/lib/active_support/logger_thread_safe_level.rb +1 -1
  151. data/lib/active_support/message_encryptor.rb +72 -35
  152. data/lib/active_support/message_verifier.rb +7 -7
  153. data/lib/active_support/multibyte.rb +2 -2
  154. data/lib/active_support/multibyte/chars.rb +23 -21
  155. data/lib/active_support/multibyte/unicode.rb +68 -89
  156. data/lib/active_support/notifications.rb +5 -5
  157. data/lib/active_support/notifications/fanout.rb +3 -3
  158. data/lib/active_support/notifications/instrumenter.rb +5 -5
  159. data/lib/active_support/number_helper.rb +4 -4
  160. data/lib/active_support/number_helper/number_converter.rb +11 -11
  161. data/lib/active_support/number_helper/number_to_currency_converter.rb +3 -3
  162. data/lib/active_support/number_helper/number_to_delimited_converter.rb +1 -2
  163. data/lib/active_support/number_helper/number_to_human_converter.rb +6 -6
  164. data/lib/active_support/number_helper/number_to_human_size_converter.rb +6 -11
  165. data/lib/active_support/number_helper/number_to_percentage_converter.rb +1 -1
  166. data/lib/active_support/number_helper/number_to_phone_converter.rb +1 -3
  167. data/lib/active_support/number_helper/number_to_rounded_converter.rb +6 -6
  168. data/lib/active_support/option_merger.rb +1 -1
  169. data/lib/active_support/ordered_hash.rb +3 -3
  170. data/lib/active_support/ordered_options.rb +6 -4
  171. data/lib/active_support/per_thread_registry.rb +5 -5
  172. data/lib/active_support/rails.rb +12 -6
  173. data/lib/active_support/railtie.rb +3 -3
  174. data/lib/active_support/reloader.rb +1 -1
  175. data/lib/active_support/rescuable.rb +8 -14
  176. data/lib/active_support/security_utils.rb +1 -1
  177. data/lib/active_support/string_inquirer.rb +8 -2
  178. data/lib/active_support/subscriber.rb +9 -5
  179. data/lib/active_support/tagged_logging.rb +4 -4
  180. data/lib/active_support/test_case.rb +12 -29
  181. data/lib/active_support/testing/assertions.rb +100 -2
  182. data/lib/active_support/testing/autorun.rb +6 -2
  183. data/lib/active_support/testing/constant_lookup.rb +0 -1
  184. data/lib/active_support/testing/declarative.rb +1 -1
  185. data/lib/active_support/testing/deprecation.rb +3 -2
  186. data/lib/active_support/testing/isolation.rb +13 -22
  187. data/lib/active_support/testing/method_call_assertions.rb +1 -1
  188. data/lib/active_support/testing/setup_and_teardown.rb +2 -2
  189. data/lib/active_support/testing/stream.rb +28 -28
  190. data/lib/active_support/testing/tagged_logging.rb +1 -1
  191. data/lib/active_support/testing/time_helpers.rb +45 -12
  192. data/lib/active_support/time.rb +12 -12
  193. data/lib/active_support/time_with_zone.rb +16 -26
  194. data/lib/active_support/values/time_zone.rb +40 -46
  195. data/lib/active_support/values/unicode_tables.dat +0 -0
  196. data/lib/active_support/version.rb +1 -1
  197. data/lib/active_support/xml_mini.rb +34 -36
  198. data/lib/active_support/xml_mini/jdom.rb +112 -112
  199. data/lib/active_support/xml_mini/libxml.rb +15 -12
  200. data/lib/active_support/xml_mini/libxmlsax.rb +17 -15
  201. data/lib/active_support/xml_mini/nokogiri.rb +13 -11
  202. data/lib/active_support/xml_mini/nokogirisax.rb +15 -14
  203. data/lib/active_support/xml_mini/rexml.rb +9 -9
  204. metadata +8 -19
  205. data/lib/active_support/concurrency/latch.rb +0 -26
  206. data/lib/active_support/core_ext/kernel/debugger.rb +0 -3
  207. data/lib/active_support/core_ext/module/method_transplanting.rb +0 -3
  208. data/lib/active_support/core_ext/module/qualified_const.rb +0 -70
  209. data/lib/active_support/core_ext/struct.rb +0 -3
  210. data/lib/active_support/core_ext/time/marshal.rb +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: 7c93a6ec74305893c50054e579965712f900e475786e4c5e4ecfaa5535393707
4
- data.tar.gz: d567933dc1d8bcbb26b2196bd1c8cf3c73bbbd22cedffa788dc30bb3903cbc64
2
+ SHA1:
3
+ metadata.gz: b24faa7a716ac5041f15e7d350045c0d924f3d2f
4
+ data.tar.gz: '062183011cca6201592cac435ae85aa7c17d4125'
5
5
  SHA512:
6
- metadata.gz: 8d85066fd3f4036cccf567138f8412d679ae15c1c4f3300e96f2fd93c8a7516229c62a3481641e2a7a048b22490ab23f7aafb0e7ace9e6f33364d86b46cc4531
7
- data.tar.gz: 82219cb259ee1d7c39a10f8d1c35858629badee5da7fa5f027442410db07e9d9b57d0e6d4dd20c8f8864c7ea3be8775bcd14b8942e185b0490fe5a177cca7822
6
+ metadata.gz: 11e55fb810a57d7661ac3b426e5b720a814ba276e93221d4dbc2b35676e3006a58d8ea74b0ecd1603d83e1b520abf27a157ea3a17aa6eb955fdd5ed3d3bce1c0
7
+ data.tar.gz: f4cf5759de9351d52827c9070581ea463295d62e83bd345c91dc81b8db4605efb4264dcbad8f88f0e8c8d6b5a3b5952120be6f4bfcc814f22cf1a25884e706b4
@@ -1,129 +1,158 @@
1
- ## Rails 5.0.7.2 (March 11, 2019) ##
1
+ ## Rails 5.1.0.beta1 (February 23, 2017) ##
2
2
 
3
- * No changes.
3
+ * Cache `ActiveSupport::TimeWithZone#to_datetime` before freezing.
4
4
 
5
+ *Adam Rice*
5
6
 
6
- ## Rails 5.0.7.1 (November 27, 2018) ##
7
+ * Deprecate `.halt_callback_chains_on_return_false`.
7
8
 
8
- * No changes.
9
+ *Rafael Mendonça França*
9
10
 
11
+ * Remove deprecated behavior that halts callbacks when the return is false.
10
12
 
11
- ## Rails 5.0.7 (March 29, 2018) ##
13
+ *Rafael Mendonça França*
12
14
 
13
- * Return all mappings for a timezone identifier in `country_zones`
15
+ * Deprecate passing string to `:if` and `:unless` conditional options
16
+ on `set_callback` and `skip_callback`.
14
17
 
15
- Some timezones like `Europe/London` have multiple mappings in
16
- `ActiveSupport::TimeZone::MAPPING` so return all of them instead
17
- of the first one found by using `Hash#value`. e.g:
18
+ *Ryuta Kamizono*
18
19
 
19
- # Before
20
- ActiveSupport::TimeZone.country_zones("GB") # => ["Edinburgh"]
20
+ * Raise `ArgumentError` when passing string to define callback.
21
21
 
22
- # After
23
- ActiveSupport::TimeZone.country_zones("GB") # => ["Edinburgh", "London"]
22
+ *Ryuta Kamizono*
24
23
 
25
- Fixes #31668.
24
+ * Updated Unicode version to 9.0.0
26
25
 
27
- *Andrew White*
26
+ Now we can handle new emojis such like "👩‍👩‍👧‍👦" ("\u{1F469}\u{200D}\u{1F469}\u{200D}\u{1F467}\u{200D}\u{1F466}").
28
27
 
28
+ version 8.0.0
29
29
 
30
- ## Rails 5.0.6 (September 07, 2017) ##
30
+ "👩‍👩‍👧‍👦".mb_chars.grapheme_length # => 4
31
+ "👩‍👩‍👧‍👦".mb_chars.reverse # => "👦👧‍👩‍👩‍"
31
32
 
32
- * No changes.
33
+ version 9.0.0
33
34
 
35
+ "👩‍👩‍👧‍👦".mb_chars.grapheme_length # => 1
36
+ "👩‍👩‍👧‍👦".mb_chars.reverse # => "👩‍👩‍👧‍👦"
34
37
 
35
- ## Rails 5.0.6.rc1 (August 24, 2017) ##
38
+ *Fumiaki MATSUSHIMA*
36
39
 
37
- * No changes.
40
+ * Changed `ActiveSupport::Inflector#transliterate` to raise `ArgumentError` when it receives
41
+ anything except a string.
38
42
 
43
+ *Kevin McPhillips*
39
44
 
40
- ## Rails 5.0.5 (July 31, 2017) ##
45
+ * Fixed bugs that `StringInquirer#respond_to_missing?` and
46
+ `ArrayInquirer#respond_to_missing?` do not fallback to `super`.
41
47
 
42
- * No changes.
48
+ *Akira Matsuda*
43
49
 
50
+ * Fix inconsistent results when parsing large durations and constructing durations from code
44
51
 
45
- ## Rails 5.0.5.rc2 (July 25, 2017) ##
52
+ ActiveSupport::Duration.parse('P3Y') == 3.years # It should be true
46
53
 
47
- * No changes.
54
+ Duration parsing made independent from any moment of time:
55
+ Fixed length in seconds is assigned to each duration part during parsing.
48
56
 
57
+ Changed duration of months and years in seconds to more accurate and logical:
49
58
 
50
- ## Rails 5.0.5.rc1 (July 19, 2017) ##
59
+ 1. The value of 365.2425 days in Gregorian year is more accurate
60
+ as it accounts for every 400th non-leap year.
51
61
 
52
- * No changes.
62
+ 2. Month's length is bound to year's duration, which makes
63
+ sensible comparisons like `12.months == 1.year` to be `true`
64
+ and nonsensical ones like `30.days == 1.month` to be `false`.
53
65
 
66
+ Calculations on times and dates with durations shouldn't be affected as
67
+ duration's numeric value isn't used in calculations, only parts are used.
54
68
 
55
- ## Rails 5.0.4 (June 19, 2017) ##
69
+ Methods on `Numeric` like `2.days` now use these predefined durations
70
+ to avoid duplicating of duration constants through the codebase and
71
+ eliminate creation of intermediate durations.
56
72
 
57
- * No changes.
73
+ *Andrey Novikov, Andrew White*
58
74
 
75
+ * Change return value of `Rational#duplicable?`, `ComplexClass#duplicable?`
76
+ to false.
59
77
 
60
- ## Rails 5.0.3 (May 12, 2017) ##
78
+ *utilum*
61
79
 
62
- * `ActiveSupport::EventedFileUpdateChecker` no longer listens to
63
- directories outside of the application directory.
80
+ * Change return value of `NilClass#duplicable?`, `FalseClass#duplicable?`,
81
+ `TrueClass#duplicable?`, `Symbol#duplicable?` and `Numeric#duplicable?`
82
+ to true with Ruby 2.4+. These classes can dup with Ruby 2.4+.
64
83
 
65
- *radiospiel*
84
+ *Yuji Yaginuma*
66
85
 
67
- * Return unmapped timezones from `country_zones`
86
+ * Remove deprecated class `ActiveSupport::Concurrency::Latch`.
68
87
 
69
- If a country doesn't exist in the MAPPINGS hash then create a new
70
- `ActiveSupport::Timezone` instance using the supplied timezone id.
88
+ *Andrew White*
71
89
 
72
- Fixes #28431.
90
+ * Remove deprecated separator argument from `parameterize`.
73
91
 
74
92
  *Andrew White*
75
93
 
76
- * Fixed bug in `DateAndTime::Compatibility#to_time` that caused it to
77
- raise `RuntimeError: can't modify frozen Time` when called on any frozen `Time`.
78
- Properly pass through the frozen `Time` or `ActiveSupport::TimeWithZone` object
79
- when calling `#to_time`.
94
+ * Remove deprecated method `Numeric#to_formatted_s`.
80
95
 
81
- *Kevin McPhillips* & *Andrew White*
96
+ *Andrew White*
82
97
 
83
- * Fix inconsistent results when parsing large durations and constructing durations from code
98
+ * Remove deprecated method `alias_method_chain`.
84
99
 
85
- ActiveSupport::Duration.parse('P3Y') == 3.years # It should be true
100
+ *Andrew White*
86
101
 
87
- Duration parsing made independent from any moment of time:
88
- Fixed length in seconds is assigned to each duration part during parsing.
102
+ * Remove deprecated constant `MissingSourceFile`.
89
103
 
90
- Methods on `Numeric` like `2.days` now use these predefined durations
91
- to avoid duplicating of duration constants through the codebase and
92
- eliminate creation of intermediate durations.
104
+ *Andrew White*
93
105
 
94
- *Andrey Novikov, Andrew White*
106
+ * Remove deprecated methods `Module.qualified_const_defined?`,
107
+ `Module.qualified_const_get` and `Module.qualified_const_set`.
95
108
 
109
+ *Andrew White*
96
110
 
97
- ## Rails 5.0.2 (March 01, 2017) ##
111
+ * Remove deprecated `:prefix` option from `number_to_human_size`.
98
112
 
99
- * In Core Extensions, make `MarshalWithAutoloading#load` pass through the second, optional
100
- argument for `Marshal#load( source [, proc] )`. This way we don't have to do
101
- `Marshal.method(:load).super_method.call(sourse, proc)` just to be able to pass a proc.
113
+ *Andrew White*
102
114
 
103
- *Jeff Latz*
115
+ * Remove deprecated method `ActiveSupport::HashWithIndifferentAccess.new_from_hash_copying_default`.
104
116
 
105
- * `ActiveSupport::Gzip.decompress` now checks checksum and length in footer.
117
+ *Andrew White*
106
118
 
107
- *Dylan Thacker-Smith*
119
+ * Remove deprecated file `active_support/core_ext/time/marshal.rb`.
108
120
 
109
- * Cache `ActiveSupport::TimeWithZone#to_datetime` before freezing.
121
+ *Andrew White*
110
122
 
111
- *Adam Rice*
123
+ * Remove deprecated file `active_support/core_ext/struct.rb`.
112
124
 
125
+ *Andrew White*
126
+
127
+ * Remove deprecated file `active_support/core_ext/module/method_transplanting.rb`.
113
128
 
114
- ## Rails 5.0.1 (December 21, 2016) ##
129
+ *Andrew White*
115
130
 
116
- * No changes.
131
+ * Remove deprecated method `Module.local_constants`.
117
132
 
133
+ *Andrew White*
118
134
 
119
- ## Rails 5.0.1.rc2 (December 10, 2016) ##
135
+ * Remove deprecated file `active_support/core_ext/kernel/debugger.rb`.
120
136
 
121
- * No changes.
137
+ *Andrew White*
122
138
 
139
+ * Remove deprecated method `ActiveSupport::Cache::Store#namespaced_key`.
123
140
 
124
- ## Rails 5.0.1.rc1 (December 01, 2016) ##
141
+ *Andrew White*
125
142
 
126
- * Ensure duration parsing is consistent across DST changes
143
+ * Remove deprecated method `ActiveSupport::Cache::Strategy::LocalCache::LocalStore#set_cache_value`.
144
+
145
+ *Andrew White*
146
+
147
+ * Remove deprecated method `ActiveSupport::Cache::MemCacheStore#escape_key`.
148
+
149
+ *Andrew White*
150
+
151
+ * Remove deprecated method `ActiveSupport::Cache::FileStore#key_file_path`.
152
+
153
+ *Andrew White*
154
+
155
+ * Ensure duration parsing is consistent across DST changes.
127
156
 
128
157
  Previously `ActiveSupport::Duration.parse` used `Time.current` and
129
158
  `Time#advance` to calculate the number of seconds in the duration
@@ -143,16 +172,24 @@
143
172
 
144
173
  *Andrew White*
145
174
 
175
+ * Use `Hash#compact` and `Hash#compact!` from Ruby 2.4. Old Ruby versions
176
+ will continue to get these methods from Active Support as before.
177
+
178
+ *Prathamesh Sonpatki*
179
+
180
+ * Fix `ActiveSupport::TimeZone#strptime`.
181
+ Support for timestamps in format of seconds (%s) and milliseconds (%Q).
182
+
183
+ Fixes #26840.
184
+
185
+ *Lev Denisov*
186
+
146
187
  * Fix `DateAndTime::Calculations#copy_time_to`. Copy `nsec` instead of `usec`.
147
188
 
148
189
  Jumping forward or backward between weeks now preserves nanosecond digits.
149
190
 
150
191
  *Josua Schmid*
151
192
 
152
- * Avoid bumping the class serial when invoking executor.
153
-
154
- *Matthew Draper*
155
-
156
193
  * Fix `ActiveSupport::TimeWithZone#in` across DST boundaries.
157
194
 
158
195
  Previously calls to `in` were being sent to the non-DST aware
@@ -172,6 +209,12 @@
172
209
 
173
210
  *Thomas Balthazar*
174
211
 
212
+ * Remove unused parameter `options = nil` for `#clear` of
213
+ `ActiveSupport::Cache::Strategy::LocalCache::LocalStore` and
214
+ `ActiveSupport::Cache::Strategy::LocalCache`.
215
+
216
+ *Yosuke Kabuto*
217
+
175
218
  * Fix `thread_mattr_accessor` subclass no longer overwrites parent.
176
219
 
177
220
  Assigning a value to a subclass using `thread_mattr_accessor` no
@@ -208,811 +251,163 @@
208
251
 
209
252
  *Andrew White*
210
253
 
211
- * Fix `ActiveSupport::TimeZone#strptime`. Now raises `ArgumentError` when the
212
- given time doesn't match the format. The error is the same as the one given
213
- by Ruby's `Date.strptime`. Previously it raised
214
- `NoMethodError: undefined method empty? for nil:NilClass.` due to a bug.
254
+ * Defines `Regexp.match?` for Ruby versions prior to 2.4. The predicate
255
+ has the same interface, but it does not have the performance boost. Its
256
+ purpose is to be able to write 2.4 compatible code.
215
257
 
216
- Fixes #25701.
258
+ *Xavier Noria*
217
259
 
218
- *John Gesimondo*
260
+ * Allow `MessageEncryptor` to take advantage of authenticated encryption modes.
219
261
 
262
+ AEAD modes like `aes-256-gcm` provide both confidentiality and data
263
+ authenticity, eliminating the need to use `MessageVerifier` to check if the
264
+ encrypted data has been tampered with. This speeds up encryption/decryption
265
+ and results in shorter cipher text.
220
266
 
221
- ## Rails 5.0.0 (June 30, 2016) ##
267
+ *Bart de Water*
222
268
 
223
- * Support parsing JSON time in ISO8601 local time strings in
224
- `ActiveSupport::JSON.decode` when `parse_json_times` is enabled.
225
- Strings in the format of `YYYY-MM-DD hh:mm:ss` (without a `Z` at
226
- the end) will be parsed in the local timezone (`Time.zone`). In
227
- addition, date strings (`YYYY-MM-DD`) are now parsed into `Date`
228
- objects.
229
-
230
- *Grzegorz Witek*
231
-
232
- * `Date.to_s` doesn't produce too many spaces. For example, `to_s(:short)`
233
- will now produce `01 Feb` instead of ` 1 Feb`.
234
-
235
- Fixes #25251.
236
-
237
- *Sean Griffin*
238
-
239
- * Rescuable: If a handler doesn't match the exception, check for handlers
240
- matching the exception's cause.
241
-
242
- *Jeremy Daer*
243
-
244
- * `ActiveSupport::Duration` supports weeks and hours.
245
-
246
- [1.hour.inspect, 1.hour.value, 1.hour.parts]
247
- # => ["3600 seconds", 3600, [[:seconds, 3600]]] # Before
248
- # => ["1 hour", 3600, [[:hours, 1]]] # After
249
-
250
- [1.week.inspect, 1.week.value, 1.week.parts]
251
- # => ["7 days", 604800, [[:days, 7]]] # Before
252
- # => ["1 week", 604800, [[:weeks, 1]]] # After
253
-
254
- This brings us into closer conformance with ISO8601 and relieves some
255
- astonishment about getting `1.hour.inspect # => 3600 seconds`.
256
-
257
- Compatibility: The duration's `value` remains the same, so apps using
258
- durations are oblivious to the new time periods. Apps, libraries, and
259
- plugins that work with the internal `parts` hash will need to broaden
260
- their time period handling to cover hours & weeks.
261
-
262
- *Andrey Novikov*
263
-
264
- * Time zones: Ensure that the UTC offset reflects DST changes that occurred
265
- since the app started. Removes UTC offset caching, reducing performance,
266
- but this is still relatively quick and isn't in any hot paths.
267
-
268
- *Alexey Shein*
269
-
270
- * Make `getlocal` and `getutc` always return instances of `Time` for
271
- `ActiveSupport::TimeWithZone` and `DateTime`. This eliminates a possible
272
- stack level too deep error in `to_time` where `ActiveSupport::TimeWithZone`
273
- was wrapping a `DateTime` instance. As a consequence of this the internal
274
- time value in `ActiveSupport::TimeWithZone` is now always an instance of
275
- `Time` in the UTC timezone, whether that's as the UTC time directly or
276
- a representation of the local time in the timezone. There should be no
277
- consequences of this internal change and if there are it's a bug due to
278
- leaky abstractions.
279
-
280
- *Andrew White*
281
-
282
- * Add `DateTime#subsec` to return the fraction of a second as a `Rational`.
283
-
284
- *Andrew White*
285
-
286
- * Add additional aliases for `DateTime#utc` to mirror the ones on
287
- `ActiveSupport::TimeWithZone` and `Time`.
288
-
289
- *Andrew White*
269
+ * Introduce `assert_changes` and `assert_no_changes`.
290
270
 
291
- * Add `DateTime#localtime` to return an instance of `Time` in the system's
292
- local timezone. Also aliased to `getlocal`.
271
+ `assert_changes` is a more general `assert_difference` that works with any
272
+ value.
293
273
 
294
- *Andrew White*, *Yuichiro Kaneko*
295
-
296
- * Add `Time#sec_fraction` to return the fraction of a second as a `Rational`.
297
-
298
- *Andrew White*
299
-
300
- * Add `ActiveSupport.to_time_preserves_timezone` config option to control
301
- how `to_time` handles timezones. In Ruby 2.4+ the behavior will change
302
- from converting to the local system timezone, to preserving the timezone
303
- of the receiver. This config option defaults to false so that apps made
304
- with earlier versions of Rails are not affected when upgrading, e.g:
305
-
306
- >> ENV['TZ'] = 'US/Eastern'
307
-
308
- >> "2016-04-23T10:23:12.000Z".to_time
309
- => "2016-04-23T06:23:12.000-04:00"
310
-
311
- >> ActiveSupport.to_time_preserves_timezone = true
312
-
313
- >> "2016-04-23T10:23:12.000Z".to_time
314
- => "2016-04-23T10:23:12.000Z"
315
-
316
- Fixes #24617.
317
-
318
- *Andrew White*
319
-
320
- * `ActiveSupport::TimeZone.country_zones(country_code)` looks up the
321
- country's time zones by its two-letter ISO3166 country code, e.g.
322
-
323
- >> ActiveSupport::TimeZone.country_zones(:jp).map(&:to_s)
324
- => ["(GMT+09:00) Osaka"]
325
-
326
- >> ActiveSupport::TimeZone.country_zones(:uy).map(&:to_s)
327
- => ["(GMT-03:00) Montevideo"]
328
-
329
- *Andrey Novikov*
330
-
331
- * `Array#sum` compat with Ruby 2.4's native method.
332
-
333
- Ruby 2.4 introduces `Array#sum`, but it only supports numeric elements,
334
- breaking our `Enumerable#sum` which supports arbitrary `Object#+`.
335
- To fix, override `Array#sum` with our compatible implementation.
336
-
337
- Native Ruby 2.4:
338
-
339
- %w[ a b ].sum
340
- # => TypeError: String can't be coerced into Fixnum
341
-
342
- With `Enumerable#sum` shim:
343
-
344
- %w[ a b ].sum
345
- # => 'ab'
346
-
347
- We tried shimming the fast path and falling back to the compatible path
348
- if it fails, but that ends up slower even in simple cases due to the cost
349
- of exception handling. Our only choice is to override the native `Array#sum`
350
- with our `Enumerable#sum`.
351
-
352
- *Jeremy Daer*
353
-
354
- * `ActiveSupport::Duration` supports ISO8601 formatting and parsing.
355
-
356
- ActiveSupport::Duration.parse('P3Y6M4DT12H30M5S')
357
- # => 3 years, 6 months, 4 days, 12 hours, 30 minutes, and 5 seconds
358
-
359
- (3.years + 3.days).iso8601
360
- # => "P3Y3D"
361
-
362
- Inspired by Arnau Siches' [ISO8601 gem](https://github.com/arnau/ISO8601/)
363
- and rewritten by Andrey Novikov with suggestions from Andrew White. Test
364
- data from the ISO8601 gem redistributed under MIT license.
365
-
366
- (Will be used to support the PostgreSQL interval data type.)
367
-
368
- *Andrey Novikov*, *Arnau Siches*, *Andrew White*
369
-
370
- * `Cache#fetch(key, force: true)` forces a cache miss, so it must be called
371
- with a block to provide a new value to cache. Fetching with `force: true`
372
- but without a block now raises ArgumentError.
373
-
374
- cache.fetch('key', force: true) # => ArgumentError
375
-
376
- *Santosh Wadghule*
377
-
378
- * Fix behavior of JSON encoding for `Exception`.
379
-
380
- *namusyaka*
381
-
382
- * Make `number_to_phone` format number with regexp pattern.
383
-
384
- number_to_phone(18812345678, pattern: /(\d{3})(\d{4})(\d{4})/)
385
- # => 188-1234-5678
386
-
387
- *Pan Gaoyong*
388
-
389
- * Match `String#to_time`'s behaviour to that of ruby's implementation for edge cases.
390
-
391
- `nil` is now returned instead of the current date if the string provided does
392
- contain time information, but none that is used to build the `Time` object.
393
-
394
- Fixes #22958.
395
-
396
- *Siim Liiser*
397
-
398
- * Rely on the native DateTime#<=> implementation to handle non-datetime like
399
- objects instead of returning `nil` ourselves. This restores the ability
400
- of `DateTime` instances to be compared with a `Numeric` that represents an
401
- astronomical julian day number.
402
-
403
- Fixes #24228.
404
-
405
- *Andrew White*
406
-
407
- * Add `String#upcase_first` method.
408
-
409
- *Glauco Custódio*, *bogdanvlviv*
410
-
411
- * Prevent `Marshal.load` from looping infinitely when trying to autoload a constant
412
- which resolves to a different name.
413
-
414
- *Olek Janiszewski*
415
-
416
- * Deprecate `Module.local_constants`. Please use `Module.constants(false)` instead.
417
-
418
- *Yuichiro Kaneko*
419
-
420
- * Publish `ActiveSupport::Executor` and `ActiveSupport::Reloader` APIs to allow
421
- components and libraries to manage, and participate in, the execution of
422
- application code, and the application reloading process.
423
-
424
- *Matthew Draper*
425
-
426
- * Deprecate arguments on `assert_nothing_raised`.
427
-
428
- `assert_nothing_raised` does not assert the arguments that have been passed
429
- in (usually a specific exception class) since the method only yields the
430
- block. So as not to confuse the users that the arguments have meaning, they
431
- are being deprecated.
432
-
433
- *Tara Scherner de la Fuente*
434
-
435
- * Make `benchmark('something', silence: true)` actually work.
436
-
437
- *DHH*
438
-
439
- * Add `#on_weekday?` method to `Date`, `Time`, and `DateTime`.
440
-
441
- `#on_weekday?` returns `true` if the receiving date/time does not fall on a Saturday
442
- or Sunday.
443
-
444
- *Vipul A M*
445
-
446
- * Add `Array#second_to_last` and `Array#third_to_last` methods.
447
-
448
- *Brian Christian*
449
-
450
- * Fix regression in `Hash#dig` for HashWithIndifferentAccess.
451
-
452
- *Jon Moss*
453
-
454
- * Change `number_to_currency` behavior for checking negativity.
455
-
456
- Used `to_f.negative` instead of using `to_f.phase` for checking negativity
457
- of a number in number_to_currency helper.
458
- This change works same for all cases except when number is "-0.0".
459
-
460
- -0.0.to_f.negative? => false
461
- -0.0.to_f.phase? => 3.14
462
-
463
- This change reverts changes from https://github.com/rails/rails/pull/6512.
464
- But it should be acceptable as we could not find any currency which
465
- supports negative zeros.
466
-
467
- *Prathamesh Sonpatki*, *Rafael Mendonça França*
468
-
469
- * Match `HashWithIndifferentAccess#default`'s behaviour with `Hash#default`.
470
-
471
- *David Cornu*
472
-
473
- * Adds `:exception_object` key to `ActiveSupport::Notifications::Instrumenter`
474
- payload when an exception is raised.
475
-
476
- Adds new key/value pair to payload when an exception is raised:
477
- e.g. `:exception_object => #<RuntimeError: FAIL>`.
478
-
479
- *Ryan T. Hosford*
480
-
481
- * Support extended grapheme clusters and UAX 29.
482
-
483
- *Adam Roben*
484
-
485
- * Add petabyte and exabyte numeric conversion.
486
-
487
- *Akshay Vishnoi*
488
-
489
- * Add thread_m/cattr_accessor/reader/writer suite of methods for declaring class and module variables that live per-thread.
490
- This makes it easy to declare per-thread globals that are encapsulated. Note: This is a sharp edge. A wild proliferation
491
- of globals is A Bad Thing. But like other sharp tools, when it's right, it's right.
492
-
493
- Here's an example of a simple event tracking system where the object being tracked needs not pass a creator that it
494
- doesn't need itself along:
495
-
496
- module Current
497
- thread_mattr_accessor :account
498
- thread_mattr_accessor :user
499
-
500
- def self.reset() self.account = self.user = nil end
274
+ assert_changes 'Error.current', from: nil, to: 'ERR' do
275
+ expected_bad_operation
501
276
  end
502
277
 
503
- class ApplicationController < ActionController::Base
504
- before_action :set_current
505
- after_action { Current.reset }
506
-
507
- private
508
- def set_current
509
- Current.account = Account.find(params[:account_id])
510
- Current.user = Current.account.users.find(params[:user_id])
511
- end
512
- end
278
+ Can be called with strings, to be evaluated in the binding (context) of
279
+ the block given to the assertion, or a lambda.
513
280
 
514
- class MessagesController < ApplicationController
515
- def create
516
- @message = Message.create!(message_params)
517
- end
281
+ assert_changes -> { Error.current }, from: nil, to: 'ERR' do
282
+ expected_bad_operation
518
283
  end
519
284
 
520
- class Message < ApplicationRecord
521
- has_many :events
522
- after_create :track_created
523
-
524
- private
525
- def track_created
526
- events.create! origin: self, action: :create
527
- end
528
- end
285
+ The `from` and `to` arguments are compared with the case operator (`===`).
529
286
 
530
- class Event < ApplicationRecord
531
- belongs_to :creator, class_name: 'User'
532
- before_validation { self.creator ||= Current.user }
287
+ assert_changes 'Error.current', from: nil, to: Error do
288
+ expected_bad_operation
533
289
  end
534
290
 
535
- *DHH*
536
-
537
-
538
- * Deprecated `Module#qualified_const_` in favour of the builtin Module#const_
539
- methods.
540
-
541
- *Genadi Samokovarov*
291
+ This is pretty useful, if you need to loosely compare a value. For example,
292
+ you need to test a token has been generated and it has that many random
293
+ characters.
542
294
 
543
- * Deprecate passing string to define callback.
544
-
545
- *Yuichiro Kaneko*
546
-
547
- * `ActiveSupport::Cache::Store#namespaced_key`,
548
- `ActiveSupport::Cache::MemCachedStore#escape_key`, and
549
- `ActiveSupport::Cache::FileStore#key_file_path`
550
- are deprecated and replaced with `normalize_key` that now calls `super`.
551
-
552
- `ActiveSupport::Cache::LocaleCache#set_cache_value` is deprecated and replaced with `write_cache_value`.
553
-
554
- *Michael Grosser*
555
-
556
- * Implements an evented file watcher to asynchronously detect changes in the
557
- application source code, routes, locales, etc.
558
-
559
- This watcher is disabled by default, applications my enable it in the configuration:
560
-
561
- # config/environments/development.rb
562
- config.file_watcher = ActiveSupport::EventedFileUpdateChecker
563
-
564
- This feature depends on the [listen](https://github.com/guard/listen) gem:
565
-
566
- group :development do
567
- gem 'listen', '~> 3.0.5'
295
+ user = User.start_registration
296
+ assert_changes 'user.token', to: /\w{32}/ do
297
+ user.finish_registration
568
298
  end
569
299
 
570
- *Puneet Agarwal* and *Xavier Noria*
571
-
572
- * Added `Time.days_in_year` to return the number of days in the given year, or the
573
- current year if no argument is provided.
574
-
575
- *Jon Pascoe*
576
-
577
- * Updated `parameterize` to preserve the case of a string, optionally.
578
-
579
- Example:
580
-
581
- parameterize("Donald E. Knuth", separator: '_') # => "donald_e_knuth"
582
- parameterize("Donald E. Knuth", preserve_case: true) # => "Donald-E-Knuth"
583
-
584
- *Swaathi Kakarla*
585
-
586
- * `HashWithIndifferentAccess.new` respects the default value or proc on objects
587
- that respond to `#to_hash`. `.new_from_hash_copying_default` simply invokes `.new`.
588
- All calls to `.new_from_hash_copying_default` are replaced with `.new`.
589
-
590
- *Gordon Chan*
591
-
592
- * Change Integer#year to return a Fixnum instead of a Float to improve
593
- consistency.
594
-
595
- Integer#years returned a Float while the rest of the accompanying methods
596
- (days, weeks, months, etc.) return a Fixnum.
597
-
598
- Before:
599
-
600
- 1.year # => 31557600.0
601
-
602
- After:
603
-
604
- 1.year # => 31557600
605
-
606
- *Konstantinos Rousis*
607
-
608
- * Handle invalid UTF-8 strings when HTML escaping.
609
-
610
- Use `ActiveSupport::Multibyte::Unicode.tidy_bytes` to handle invalid UTF-8
611
- strings in `ERB::Util.unwrapped_html_escape` and `ERB::Util.html_escape_once`.
612
- Prevents user-entered input passed from a querystring into a form field from
613
- causing invalid byte sequence errors.
614
-
615
- *Grey Baker*
616
-
617
- * Update `ActiveSupport::Multibyte::Chars#slice!` to return `nil` if the
618
- arguments are out of bounds, to mirror the behavior of `String#slice!`
619
-
620
- *Gourav Tiwari*
621
-
622
- * Fix `number_to_human` so that 999999999 rounds to "1 Billion" instead of
623
- "1000 Million".
624
-
625
- *Max Jacobson*
626
-
627
- * Fix `ActiveSupport::Deprecation#deprecate_methods` to report using the
628
- current deprecator instance, where applicable.
629
-
630
- *Brandon Dunne*
631
-
632
- * `Cache#fetch` instrumentation marks whether it was a `:hit`.
633
-
634
- *Robin Clowers*
635
-
636
- * `assert_difference` and `assert_no_difference` now returns the result of the
637
- yielded block.
638
-
639
- Example:
640
-
641
- post = assert_difference -> { Post.count }, 1 do
642
- Post.create
643
- end
644
-
645
- *Lucas Mazza*
646
-
647
- * Short-circuit `blank?` on date and time values since they are never blank.
648
-
649
- Fixes #21657.
650
-
651
- *Andrew White*
652
-
653
- * Replaced deprecated `ThreadSafe::Cache` with its successor `Concurrent::Map` now that
654
- the thread_safe gem has been merged into concurrent-ruby.
655
-
656
- *Jerry D'Antonio*
657
-
658
- * Updated Unicode version to 8.0.0
659
-
660
- *Anshul Sharma*
661
-
662
- * `number_to_currency` and `number_with_delimiter` now accept custom `delimiter_pattern` option
663
- to handle placement of delimiter, to support currency formats like INR
300
+ *Genadi Samokovarov*
664
301
 
665
- Example:
302
+ * Fix `ActiveSupport::TimeZone#strptime`. Now raises `ArgumentError` when the
303
+ given time doesn't match the format. The error is the same as the one given
304
+ by Ruby's `Date.strptime`. Previously it raised
305
+ `NoMethodError: undefined method empty? for nil:NilClass.` due to a bug.
666
306
 
667
- number_to_currency(1230000, delimiter_pattern: /(\d+?)(?=(\d\d)+(\d)(?!\d))/, unit: '₹', format: "%u %n")
668
- # => '₹ 12,30,000.00'
307
+ Fixes #25701.
669
308
 
670
- *Vipul A M*
309
+ *John Gesimondo*
671
310
 
672
- * Deprecate `:prefix` option of `number_to_human_size` with no replacement.
311
+ * `travel/travel_to` travel time helpers, now raise on nested calls,
312
+ as this can lead to confusing time stubbing.
673
313
 
674
- *Jean Boussier*
314
+ Instead of:
675
315
 
676
- * Fix `TimeWithZone#eql?` to properly handle `TimeWithZone` created from `DateTime`:
677
- twz = DateTime.now.in_time_zone
678
- twz.eql?(twz.dup) => true
316
+ travel_to 2.days.from_now do
317
+ # 2 days from today
318
+ travel_to 3.days.from_now do
319
+ # 5 days from today
320
+ end
321
+ end
679
322
 
680
- Fixes #14178.
323
+ preferred way to achieve above is:
681
324
 
682
- *Roque Pinel*
325
+ travel 2.days do
326
+ # 2 days from today
327
+ end
683
328
 
684
- * ActiveSupport::HashWithIndifferentAccess `select` and `reject` will now return
685
- enumerator if called without block.
329
+ travel 5.days do
330
+ # 5 days from today
331
+ end
686
332
 
687
- Fixes #20095.
333
+ *Vipul A M*
688
334
 
689
- *Bernard Potocki*
335
+ * Support parsing JSON time in ISO8601 local time strings in
336
+ `ActiveSupport::JSON.decode` when `parse_json_times` is enabled.
337
+ Strings in the format of `YYYY-MM-DD hh:mm:ss` (without a `Z` at
338
+ the end) will be parsed in the local timezone (`Time.zone`). In
339
+ addition, date strings (`YYYY-MM-DD`) are now parsed into `Date`
340
+ objects.
690
341
 
691
- * Removed `ActiveSupport::Concurrency::Latch`, superseded by `Concurrent::CountDownLatch`
692
- from the concurrent-ruby gem.
342
+ *Grzegorz Witek*
693
343
 
694
- *Jerry D'Antonio*
344
+ * Fixed `ActiveSupport::Logger.broadcast` so that calls to `#silence` now
345
+ properly delegate to all loggers. Silencing now properly suppresses logging
346
+ to both the log and the console.
695
347
 
696
- * Fix not calling `#default` on `HashWithIndifferentAccess#to_hash` when only
697
- `default_proc` is set, which could raise.
348
+ *Kevin McPhillips*
698
349
 
699
- *Simon Eskildsen*
350
+ * Remove deprecated arguments in `assert_nothing_raised`.
700
351
 
701
- * Fix setting `default_proc` on `HashWithIndifferentAccess#dup`.
352
+ *Rafel Mendonça França*
702
353
 
703
- *Simon Eskildsen*
354
+ * `Date.to_s` doesn't produce too many spaces. For example, `to_s(:short)`
355
+ will now produce `01 Feb` instead of ` 1 Feb`.
704
356
 
705
- * Fix a range of values for parameters of the Time#change.
357
+ Fixes #25251.
706
358
 
707
- *Nikolay Kondratyev*
359
+ *Sean Griffin*
708
360
 
709
- * Add `Enumerable#pluck` to get the same values from arrays as from ActiveRecord
710
- associations.
361
+ * Introduce `Module#delegate_missing_to`.
711
362
 
712
- Fixes #20339.
363
+ When building a decorator, a common pattern emerges:
713
364
 
714
- *Kevin Deisz*
365
+ class Partition
366
+ def initialize(first_event)
367
+ @events = [ first_event ]
368
+ end
715
369
 
716
- * Add a bang version to `ActiveSupport::OrderedOptions` get methods which will raise
717
- an `KeyError` if the value is `.blank?`.
370
+ def people
371
+ if @events.first.detail.people.any?
372
+ @events.collect { |e| Array(e.detail.people) }.flatten.uniq
373
+ else
374
+ @events.collect(&:creator).uniq
375
+ end
376
+ end
718
377
 
719
- Before:
378
+ private
379
+ def respond_to_missing?(name, include_private = false)
380
+ @events.respond_to?(name, include_private)
381
+ end
720
382
 
721
- if (slack_url = Rails.application.secrets.slack_url).present?
722
- # Do something worthwhile
723
- else
724
- # Raise as important secret password is not specified
383
+ def method_missing(method, *args, &block)
384
+ @events.send(method, *args, &block)
385
+ end
725
386
  end
726
387
 
727
- After:
728
-
729
- slack_url = Rails.application.secrets.slack_url!
730
-
731
- *Aditya Sanghi*, *Gaurish Sharma*
732
-
733
- * Remove deprecated `Class#superclass_delegating_accessor`.
734
- Use `Class#class_attribute` instead.
735
-
736
- *Akshay Vishnoi*
737
-
738
- * Patch `Delegator` to work with `#try`.
739
-
740
- Fixes #5790.
741
-
742
- *Nate Smith*
743
-
744
- * Add `Integer#positive?` and `Integer#negative?` query methods
745
- in the vein of `Fixnum#zero?`.
746
-
747
- This makes it nicer to do things like `bunch_of_numbers.select(&:positive?)`.
748
-
749
- *DHH*
750
-
751
- * Encoding `ActiveSupport::TimeWithZone` to YAML now preserves the timezone information.
752
-
753
- Fixes #9183.
754
-
755
- *Andrew White*
756
-
757
- * Added `ActiveSupport::TimeZone#strptime` to allow parsing times as if
758
- from a given timezone.
759
-
760
- *Paul A Jungwirth*
761
-
762
- * `ActiveSupport::Callbacks#skip_callback` now raises an `ArgumentError` if
763
- an unrecognized callback is removed.
764
-
765
- *Iain Beeston*
766
-
767
- * Added `ActiveSupport::ArrayInquirer` and `Array#inquiry`.
768
-
769
- Wrapping an array in an `ArrayInquirer` gives a friendlier way to check its
770
- contents:
771
-
772
- variants = ActiveSupport::ArrayInquirer.new([:phone, :tablet])
773
-
774
- variants.phone? # => true
775
- variants.tablet? # => true
776
- variants.desktop? # => false
388
+ With `Module#delegate_missing_to`, the above is condensed to:
777
389
 
778
- variants.any?(:phone, :tablet) # => true
779
- variants.any?(:phone, :desktop) # => true
780
- variants.any?(:desktop, :watch) # => false
390
+ class Partition
391
+ delegate_missing_to :@events
781
392
 
782
- `Array#inquiry` is a shortcut for wrapping the receiving array in an
783
- `ArrayInquirer`.
784
-
785
- *George Claghorn*
786
-
787
- * Deprecate `alias_method_chain` in favour of `Module#prepend` introduced in
788
- Ruby 2.0.
789
-
790
- *Kir Shatrov*
791
-
792
- * Added `#without` on `Enumerable` and `Array` to return a copy of an
793
- enumerable without the specified elements.
794
-
795
- *Todd Bealmear*
796
-
797
- * Fixed a problem where `String#truncate_words` would get stuck with a complex
798
- string.
799
-
800
- *Henrik Nygren*
801
-
802
- * Fixed a roundtrip problem with `AS::SafeBuffer` where primitive-like strings
803
- will be dumped as primitives:
804
-
805
- Before:
806
-
807
- YAML.load ActiveSupport::SafeBuffer.new("Hello").to_yaml # => "Hello"
808
- YAML.load ActiveSupport::SafeBuffer.new("true").to_yaml # => true
809
- YAML.load ActiveSupport::SafeBuffer.new("false").to_yaml # => false
810
- YAML.load ActiveSupport::SafeBuffer.new("1").to_yaml # => 1
811
- YAML.load ActiveSupport::SafeBuffer.new("1.1").to_yaml # => 1.1
812
-
813
- After:
814
-
815
- YAML.load ActiveSupport::SafeBuffer.new("Hello").to_yaml # => "Hello"
816
- YAML.load ActiveSupport::SafeBuffer.new("true").to_yaml # => "true"
817
- YAML.load ActiveSupport::SafeBuffer.new("false").to_yaml # => "false"
818
- YAML.load ActiveSupport::SafeBuffer.new("1").to_yaml # => "1"
819
- YAML.load ActiveSupport::SafeBuffer.new("1.1").to_yaml # => "1.1"
820
-
821
- *Godfrey Chan*
822
-
823
- * Enable `number_to_percentage` to keep the number's precision by allowing
824
- `:precision` to be `nil`.
825
-
826
- *Jack Xu*
827
-
828
- * `config_accessor` became a private method, as with Ruby's `attr_accessor`.
829
-
830
- *Akira Matsuda*
831
-
832
- * `AS::Testing::TimeHelpers#travel_to` now changes `DateTime.now` as well as
833
- `Time.now` and `Date.today`.
834
-
835
- *Yuki Nishijima*
836
-
837
- * Add `file_fixture` to `ActiveSupport::TestCase`.
838
- It provides a simple mechanism to access sample files in your test cases.
839
-
840
- By default file fixtures are stored in `test/fixtures/files`. This can be
841
- configured per test-case using the `file_fixture_path` class attribute.
842
-
843
- *Yves Senn*
844
-
845
- * Return value of yielded block in `File.atomic_write`.
846
-
847
- *Ian Ker-Seymer*
848
-
849
- * Duplicate frozen array when assigning it to a `HashWithIndifferentAccess` so
850
- that it doesn't raise a `RuntimeError` when calling `map!` on it in `convert_value`.
851
-
852
- Fixes #18550.
853
-
854
- *Aditya Kapoor*
855
-
856
- * Add missing time zone definitions for Russian Federation and sync them
857
- with `zone.tab` file from tzdata version 2014j (latest).
858
-
859
- *Andrey Novikov*
860
-
861
- * Add `SecureRandom.base58` for generation of random base58 strings.
862
-
863
- *Matthew Draper*, *Guillermo Iguaran*
864
-
865
- * Add `#prev_day` and `#next_day` counterparts to `#yesterday` and
866
- `#tomorrow` for `Date`, `Time`, and `DateTime`.
867
-
868
- *George Claghorn*
869
-
870
- * Add `same_time` option to `#next_week` and `#prev_week` for `Date`, `Time`,
871
- and `DateTime`.
872
-
873
- *George Claghorn*
874
-
875
- * Add `#on_weekend?`, `#next_weekday`, `#prev_weekday` methods to `Date`,
876
- `Time`, and `DateTime`.
877
-
878
- `#on_weekend?` returns `true` if the receiving date/time falls on a Saturday
879
- or Sunday.
880
-
881
- `#next_weekday` returns a new date/time representing the next day that does
882
- not fall on a Saturday or Sunday.
883
-
884
- `#prev_weekday` returns a new date/time representing the previous day that
885
- does not fall on a Saturday or Sunday.
886
-
887
- *George Claghorn*
888
-
889
- * Added ability to `TaggedLogging` to allow loggers to be instantiated multiple times
890
- so that they don't share tags with each other.
891
-
892
- Rails.logger = Logger.new(STDOUT)
893
-
894
- # Before
895
- custom_logger = ActiveSupport::TaggedLogging.new(Rails.logger)
896
- custom_logger.push_tags "custom_tag"
897
- custom_logger.info "test" # => "[custom_tag] [custom_tag] test"
898
- Rails.logger.info "test" # => "[custom_tag] [custom_tag] test"
899
-
900
- # After
901
- custom_logger = ActiveSupport::TaggedLogging.new(Logger.new(STDOUT))
902
- custom_logger.push_tags "custom_tag"
903
- custom_logger.info "test" # => "[custom_tag] test"
904
- Rails.logger.info "test" # => "test"
905
-
906
- *Alexander Staubo*
907
-
908
- * Change the default test order from `:sorted` to `:random`.
909
-
910
- *Rafael Mendonça França*
911
-
912
- * Remove deprecated `ActiveSupport::JSON::Encoding::CircularReferenceError`.
913
-
914
- *Rafael Mendonça França*
915
-
916
- * Remove deprecated methods `ActiveSupport::JSON::Encoding.encode_big_decimal_as_string=`
917
- and `ActiveSupport::JSON::Encoding.encode_big_decimal_as_string`.
918
-
919
- *Rafael Mendonça França*
920
-
921
- * Remove deprecated `ActiveSupport::SafeBuffer#prepend`.
922
-
923
- *Rafael Mendonça França*
924
-
925
- * Remove deprecated methods at `Kernel`.
926
-
927
- `silence_stderr`, `silence_stream`, `capture` and `quietly`.
928
-
929
- *Rafael Mendonça França*
930
-
931
- * Remove deprecated `active_support/core_ext/big_decimal/yaml_conversions`
932
- file.
933
-
934
- *Rafael Mendonça França*
935
-
936
- * Remove deprecated methods `ActiveSupport::Cache::Store.instrument` and
937
- `ActiveSupport::Cache::Store.instrument=`.
938
-
939
- *Rafael Mendonça França*
940
-
941
- * Change the way in which callback chains can be halted.
942
-
943
- The preferred method to halt a callback chain from now on is to explicitly
944
- `throw(:abort)`.
945
- In the past, callbacks could only be halted by explicitly providing a
946
- terminator and by having a callback match the conditions of the terminator.
947
-
948
- * Add `ActiveSupport.halt_callback_chains_on_return_false`
949
-
950
- Setting `ActiveSupport.halt_callback_chains_on_return_false`
951
- to `true` will let an app support the deprecated way of halting Active Record,
952
- and Active Model callback chains by returning `false`.
953
-
954
- Setting the value to `false` will tell the app to ignore any `false` value
955
- returned by those callbacks, and only halt the chain upon `throw(:abort)`.
956
-
957
- When the configuration option is missing, its value is `true`, so older apps
958
- ported to Rails 5.0 will not break (but display a deprecation warning).
959
- For new Rails 5.0 apps, its value is set to `false` in an initializer, so
960
- these apps will support the new behavior by default.
961
-
962
- *claudiob*, *Roque Pinel*
963
-
964
- * Changes arguments and default value of CallbackChain's `:terminator` option
965
-
966
- Chains of callbacks defined without an explicit `:terminator` option will
967
- now be halted as soon as a `before_` callback throws `:abort`.
968
-
969
- Chains of callbacks defined with a `:terminator` option will maintain their
970
- existing behavior of halting as soon as a `before_` callback matches the
971
- terminator's expectation.
972
-
973
- *claudiob*
974
-
975
- * Deprecate `MissingSourceFile` in favor of `LoadError`.
976
-
977
- `MissingSourceFile` was just an alias to `LoadError` and was not being
978
- raised inside the framework.
979
-
980
- *Rafael Mendonça França*
981
-
982
- * Remove `Object#itself` as it is implemented in Ruby 2.2.
983
-
984
- *Cristian Bica*
985
-
986
- * Add support for error dispatcher classes in `ActiveSupport::Rescuable`.
987
- Now it acts closer to Ruby's rescue.
988
-
989
- Example:
990
-
991
- class BaseController < ApplicationController
992
- module ErrorDispatcher
993
- def self.===(other)
994
- Exception === other && other.respond_to?(:status)
995
- end
393
+ def initialize(first_event)
394
+ @events = [ first_event ]
996
395
  end
997
396
 
998
- rescue_from ErrorDispatcher do |error|
999
- render status: error.status, json: { error: error.to_s }
397
+ def people
398
+ if @events.first.detail.people.any?
399
+ @events.collect { |e| Array(e.detail.people) }.flatten.uniq
400
+ else
401
+ @events.collect(&:creator).uniq
402
+ end
1000
403
  end
1001
404
  end
1002
405
 
1003
- *Genadi Samokovarov*
1004
-
1005
- * Add `#verified` and `#valid_message?` methods to `ActiveSupport::MessageVerifier`
1006
-
1007
- Previously, the only way to decode a message with `ActiveSupport::MessageVerifier`
1008
- was to use `#verify`, which would raise an exception on invalid messages. Now
1009
- `#verified` can also be used, which returns `nil` on messages that cannot be
1010
- decoded.
406
+ *Genadi Samokovarov*, *DHH*
1011
407
 
1012
- Previously, there was no way to check if a message's format was valid without
1013
- attempting to decode it. `#valid_message?` is a boolean convenience method that
1014
- checks whether the message is valid without actually decoding it.
408
+ * Rescuable: If a handler doesn't match the exception, check for handlers
409
+ matching the exception's cause.
1015
410
 
1016
- *Logan Leger*
411
+ *Jeremy Daer*
1017
412
 
1018
- Please check [4-2-stable](https://github.com/rails/rails/blob/4-2-stable/activesupport/CHANGELOG.md) for previous changes.
413
+ Please check [5-0-stable](https://github.com/rails/rails/blob/5-0-stable/activesupport/CHANGELOG.md) for previous changes.