activesupport 4.2.11.3 → 5.0.7.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of activesupport might be problematic. Click here for more details.

Files changed (182) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +678 -348
  3. data/MIT-LICENSE +2 -2
  4. data/README.rdoc +2 -3
  5. data/lib/active_support/array_inquirer.rb +44 -0
  6. data/lib/active_support/backtrace_cleaner.rb +1 -1
  7. data/lib/active_support/benchmarkable.rb +1 -1
  8. data/lib/active_support/cache/file_store.rb +36 -22
  9. data/lib/active_support/cache/mem_cache_store.rb +63 -54
  10. data/lib/active_support/cache/memory_store.rb +16 -21
  11. data/lib/active_support/cache/null_store.rb +1 -4
  12. data/lib/active_support/cache/strategy/local_cache.rb +31 -20
  13. data/lib/active_support/cache/strategy/local_cache_middleware.rb +4 -4
  14. data/lib/active_support/cache.rb +71 -87
  15. data/lib/active_support/callbacks.rb +109 -113
  16. data/lib/active_support/concern.rb +1 -1
  17. data/lib/active_support/concurrency/latch.rb +11 -12
  18. data/lib/active_support/concurrency/share_lock.rb +226 -0
  19. data/lib/active_support/configurable.rb +1 -0
  20. data/lib/active_support/core_ext/array/access.rb +27 -1
  21. data/lib/active_support/core_ext/array/conversions.rb +6 -4
  22. data/lib/active_support/core_ext/array/grouping.rb +9 -18
  23. data/lib/active_support/core_ext/array/inquiry.rb +17 -0
  24. data/lib/active_support/core_ext/array/wrap.rb +5 -4
  25. data/lib/active_support/core_ext/array.rb +1 -0
  26. data/lib/active_support/core_ext/big_decimal/conversions.rb +8 -10
  27. data/lib/active_support/core_ext/class/attribute.rb +10 -9
  28. data/lib/active_support/core_ext/class/subclasses.rb +3 -2
  29. data/lib/active_support/core_ext/class.rb +0 -1
  30. data/lib/active_support/core_ext/date/blank.rb +12 -0
  31. data/lib/active_support/core_ext/date/calculations.rb +1 -1
  32. data/lib/active_support/core_ext/date/conversions.rb +7 -6
  33. data/lib/active_support/core_ext/date.rb +1 -1
  34. data/lib/active_support/core_ext/date_and_time/calculations.rb +100 -27
  35. data/lib/active_support/core_ext/date_and_time/compatibility.rb +0 -1
  36. data/lib/active_support/core_ext/date_and_time/zones.rb +3 -4
  37. data/lib/active_support/core_ext/date_time/blank.rb +12 -0
  38. data/lib/active_support/core_ext/date_time/calculations.rb +14 -8
  39. data/lib/active_support/core_ext/date_time/conversions.rb +2 -0
  40. data/lib/active_support/core_ext/date_time.rb +1 -1
  41. data/lib/active_support/core_ext/enumerable.rb +75 -25
  42. data/lib/active_support/core_ext/file/atomic.rb +30 -25
  43. data/lib/active_support/core_ext/hash/conversions.rb +22 -2
  44. data/lib/active_support/core_ext/hash/deep_merge.rb +1 -1
  45. data/lib/active_support/core_ext/hash/except.rb +9 -8
  46. data/lib/active_support/core_ext/hash/indifferent_access.rb +1 -1
  47. data/lib/active_support/core_ext/hash/keys.rb +25 -21
  48. data/lib/active_support/core_ext/hash/slice.rb +1 -1
  49. data/lib/active_support/core_ext/hash/transform_values.rb +11 -5
  50. data/lib/active_support/core_ext/integer/time.rb +2 -2
  51. data/lib/active_support/core_ext/kernel/concern.rb +2 -0
  52. data/lib/active_support/core_ext/kernel/debugger.rb +3 -10
  53. data/lib/active_support/core_ext/kernel/reporting.rb +2 -84
  54. data/lib/active_support/core_ext/kernel.rb +0 -1
  55. data/lib/active_support/core_ext/load_error.rb +5 -2
  56. data/lib/active_support/core_ext/marshal.rb +7 -9
  57. data/lib/active_support/core_ext/module/aliasing.rb +6 -1
  58. data/lib/active_support/core_ext/module/anonymous.rb +10 -1
  59. data/lib/active_support/core_ext/module/attr_internal.rb +2 -5
  60. data/lib/active_support/core_ext/module/attribute_accessors.rb +15 -15
  61. data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +141 -0
  62. data/lib/active_support/core_ext/module/concerning.rb +4 -4
  63. data/lib/active_support/core_ext/module/delegation.rb +11 -20
  64. data/lib/active_support/core_ext/module/deprecation.rb +2 -2
  65. data/lib/active_support/core_ext/module/introspection.rb +8 -2
  66. data/lib/active_support/core_ext/module/method_transplanting.rb +3 -13
  67. data/lib/active_support/core_ext/module/qualified_const.rb +30 -12
  68. data/lib/active_support/core_ext/module/remove_method.rb +23 -0
  69. data/lib/active_support/core_ext/module.rb +1 -0
  70. data/lib/active_support/core_ext/name_error.rb +15 -2
  71. data/lib/active_support/core_ext/numeric/bytes.rb +20 -0
  72. data/lib/active_support/core_ext/numeric/conversions.rb +78 -77
  73. data/lib/active_support/core_ext/numeric/inquiry.rb +26 -0
  74. data/lib/active_support/core_ext/numeric/time.rb +26 -6
  75. data/lib/active_support/core_ext/numeric.rb +1 -0
  76. data/lib/active_support/core_ext/object/blank.rb +15 -3
  77. data/lib/active_support/core_ext/object/deep_dup.rb +10 -3
  78. data/lib/active_support/core_ext/object/duplicable.rb +7 -12
  79. data/lib/active_support/core_ext/object/inclusion.rb +2 -2
  80. data/lib/active_support/core_ext/object/instance_variables.rb +1 -1
  81. data/lib/active_support/core_ext/object/json.rb +15 -7
  82. data/lib/active_support/core_ext/object/to_query.rb +1 -1
  83. data/lib/active_support/core_ext/object/try.rb +67 -21
  84. data/lib/active_support/core_ext/object/with_options.rb +1 -1
  85. data/lib/active_support/core_ext/object.rb +0 -1
  86. data/lib/active_support/core_ext/range/conversions.rb +18 -6
  87. data/lib/active_support/core_ext/range/each.rb +16 -18
  88. data/lib/active_support/core_ext/range/include_range.rb +20 -20
  89. data/lib/active_support/core_ext/securerandom.rb +23 -0
  90. data/lib/active_support/core_ext/string/behavior.rb +1 -1
  91. data/lib/active_support/core_ext/string/conversions.rb +3 -2
  92. data/lib/active_support/core_ext/string/filters.rb +1 -2
  93. data/lib/active_support/core_ext/string/inflections.rb +32 -5
  94. data/lib/active_support/core_ext/string/multibyte.rb +11 -7
  95. data/lib/active_support/core_ext/string/output_safety.rb +12 -14
  96. data/lib/active_support/core_ext/string/strip.rb +3 -6
  97. data/lib/active_support/core_ext/struct.rb +3 -6
  98. data/lib/active_support/core_ext/time/calculations.rb +18 -9
  99. data/lib/active_support/core_ext/time/conversions.rb +4 -2
  100. data/lib/active_support/core_ext/time/marshal.rb +2 -29
  101. data/lib/active_support/core_ext/time/zones.rb +36 -4
  102. data/lib/active_support/core_ext/time.rb +0 -1
  103. data/lib/active_support/core_ext/uri.rb +1 -3
  104. data/lib/active_support/core_ext.rb +2 -1
  105. data/lib/active_support/dependencies/interlock.rb +55 -0
  106. data/lib/active_support/dependencies.rb +88 -95
  107. data/lib/active_support/deprecation/behaviors.rb +15 -1
  108. data/lib/active_support/deprecation/instance_delegator.rb +13 -0
  109. data/lib/active_support/deprecation/method_wrappers.rb +42 -16
  110. data/lib/active_support/deprecation/proxy_wrappers.rb +47 -24
  111. data/lib/active_support/deprecation/reporting.rb +23 -5
  112. data/lib/active_support/deprecation.rb +1 -1
  113. data/lib/active_support/duration/iso8601_parser.rb +122 -0
  114. data/lib/active_support/duration/iso8601_serializer.rb +51 -0
  115. data/lib/active_support/duration.rb +90 -15
  116. data/lib/active_support/evented_file_update_checker.rb +199 -0
  117. data/lib/active_support/execution_wrapper.rb +126 -0
  118. data/lib/active_support/executor.rb +6 -0
  119. data/lib/active_support/file_update_checker.rb +23 -3
  120. data/lib/active_support/gem_version.rb +5 -5
  121. data/lib/active_support/gzip.rb +1 -1
  122. data/lib/active_support/hash_with_indifferent_access.rb +40 -11
  123. data/lib/active_support/i18n_railtie.rb +25 -4
  124. data/lib/active_support/inflector/inflections.rb +36 -5
  125. data/lib/active_support/inflector/methods.rb +97 -90
  126. data/lib/active_support/inflector/transliterate.rb +36 -21
  127. data/lib/active_support/json/decoding.rb +11 -10
  128. data/lib/active_support/json/encoding.rb +1 -51
  129. data/lib/active_support/key_generator.rb +7 -9
  130. data/lib/active_support/lazy_load_hooks.rb +46 -18
  131. data/lib/active_support/locale/en.yml +2 -0
  132. data/lib/active_support/log_subscriber/test_helper.rb +3 -3
  133. data/lib/active_support/log_subscriber.rb +1 -1
  134. data/lib/active_support/logger.rb +3 -4
  135. data/lib/active_support/logger_silence.rb +2 -1
  136. data/lib/active_support/logger_thread_safe_level.rb +2 -3
  137. data/lib/active_support/message_encryptor.rb +7 -7
  138. data/lib/active_support/message_verifier.rb +70 -8
  139. data/lib/active_support/multibyte/chars.rb +12 -3
  140. data/lib/active_support/multibyte/unicode.rb +44 -21
  141. data/lib/active_support/notifications/fanout.rb +5 -5
  142. data/lib/active_support/notifications/instrumenter.rb +20 -2
  143. data/lib/active_support/notifications.rb +2 -2
  144. data/lib/active_support/number_helper/number_to_currency_converter.rb +7 -9
  145. data/lib/active_support/number_helper/number_to_delimited_converter.rb +8 -3
  146. data/lib/active_support/number_helper/number_to_human_converter.rb +6 -4
  147. data/lib/active_support/number_helper/number_to_human_size_converter.rb +6 -2
  148. data/lib/active_support/number_helper/number_to_percentage_converter.rb +1 -1
  149. data/lib/active_support/number_helper/number_to_phone_converter.rb +11 -2
  150. data/lib/active_support/number_helper/number_to_rounded_converter.rb +30 -25
  151. data/lib/active_support/number_helper.rb +90 -67
  152. data/lib/active_support/ordered_hash.rb +1 -1
  153. data/lib/active_support/ordered_options.rb +15 -1
  154. data/lib/active_support/per_thread_registry.rb +3 -0
  155. data/lib/active_support/rails.rb +2 -2
  156. data/lib/active_support/railtie.rb +6 -1
  157. data/lib/active_support/reloader.rb +129 -0
  158. data/lib/active_support/rescuable.rb +101 -47
  159. data/lib/active_support/string_inquirer.rb +1 -1
  160. data/lib/active_support/subscriber.rb +5 -10
  161. data/lib/active_support/tagged_logging.rb +8 -7
  162. data/lib/active_support/test_case.rb +17 -29
  163. data/lib/active_support/testing/assertions.rb +15 -13
  164. data/lib/active_support/testing/deprecation.rb +9 -8
  165. data/lib/active_support/testing/file_fixtures.rb +34 -0
  166. data/lib/active_support/testing/isolation.rb +22 -8
  167. data/lib/active_support/testing/method_call_assertions.rb +41 -0
  168. data/lib/active_support/testing/stream.rb +42 -0
  169. data/lib/active_support/testing/time_helpers.rb +3 -1
  170. data/lib/active_support/time_with_zone.rb +123 -33
  171. data/lib/active_support/values/time_zone.rb +101 -47
  172. data/lib/active_support/values/unicode_tables.dat +0 -0
  173. data/lib/active_support/xml_mini/jdom.rb +1 -1
  174. data/lib/active_support/xml_mini/libxml.rb +2 -2
  175. data/lib/active_support/xml_mini/nokogiri.rb +2 -2
  176. data/lib/active_support.rb +11 -6
  177. metadata +36 -17
  178. data/lib/active_support/core_ext/big_decimal/yaml_conversions.rb +0 -16
  179. data/lib/active_support/core_ext/class/delegating_attributes.rb +0 -45
  180. data/lib/active_support/core_ext/date_time/zones.rb +0 -6
  181. data/lib/active_support/core_ext/object/itself.rb +0 -15
  182. data/lib/active_support/core_ext/thread.rb +0 -86
metadata CHANGED
@@ -1,29 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activesupport
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.11.3
4
+ version: 5.0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-15 00:00:00.000000000 Z
11
+ date: 2019-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0.7'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '2'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: '0.7'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '2'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: tzinfo
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -53,25 +59,25 @@ dependencies:
53
59
  - !ruby/object:Gem::Version
54
60
  version: '5.1'
55
61
  - !ruby/object:Gem::Dependency
56
- name: thread_safe
62
+ name: concurrent-ruby
57
63
  requirement: !ruby/object:Gem::Requirement
58
64
  requirements:
59
65
  - - "~>"
60
66
  - !ruby/object:Gem::Version
61
- version: '0.3'
67
+ version: '1.0'
62
68
  - - ">="
63
69
  - !ruby/object:Gem::Version
64
- version: 0.3.4
70
+ version: 1.0.2
65
71
  type: :runtime
66
72
  prerelease: false
67
73
  version_requirements: !ruby/object:Gem::Requirement
68
74
  requirements:
69
75
  - - "~>"
70
76
  - !ruby/object:Gem::Version
71
- version: '0.3'
77
+ version: '1.0'
72
78
  - - ">="
73
79
  - !ruby/object:Gem::Version
74
- version: 0.3.4
80
+ version: 1.0.2
75
81
  description: A toolkit of support libraries and Ruby core extensions extracted from
76
82
  the Rails framework. Rich support for multibyte strings, internationalization, time
77
83
  zones, and testing.
@@ -85,6 +91,7 @@ files:
85
91
  - README.rdoc
86
92
  - lib/active_support.rb
87
93
  - lib/active_support/all.rb
94
+ - lib/active_support/array_inquirer.rb
88
95
  - lib/active_support/backtrace_cleaner.rb
89
96
  - lib/active_support/benchmarkable.rb
90
97
  - lib/active_support/builder.rb
@@ -98,6 +105,7 @@ files:
98
105
  - lib/active_support/callbacks.rb
99
106
  - lib/active_support/concern.rb
100
107
  - lib/active_support/concurrency/latch.rb
108
+ - lib/active_support/concurrency/share_lock.rb
101
109
  - lib/active_support/configurable.rb
102
110
  - lib/active_support/core_ext.rb
103
111
  - lib/active_support/core_ext/array.rb
@@ -105,19 +113,19 @@ files:
105
113
  - lib/active_support/core_ext/array/conversions.rb
106
114
  - lib/active_support/core_ext/array/extract_options.rb
107
115
  - lib/active_support/core_ext/array/grouping.rb
116
+ - lib/active_support/core_ext/array/inquiry.rb
108
117
  - lib/active_support/core_ext/array/prepend_and_append.rb
109
118
  - lib/active_support/core_ext/array/wrap.rb
110
119
  - lib/active_support/core_ext/benchmark.rb
111
120
  - lib/active_support/core_ext/big_decimal.rb
112
121
  - lib/active_support/core_ext/big_decimal/conversions.rb
113
- - lib/active_support/core_ext/big_decimal/yaml_conversions.rb
114
122
  - lib/active_support/core_ext/class.rb
115
123
  - lib/active_support/core_ext/class/attribute.rb
116
124
  - lib/active_support/core_ext/class/attribute_accessors.rb
117
- - lib/active_support/core_ext/class/delegating_attributes.rb
118
125
  - lib/active_support/core_ext/class/subclasses.rb
119
126
  - lib/active_support/core_ext/date.rb
120
127
  - lib/active_support/core_ext/date/acts_like.rb
128
+ - lib/active_support/core_ext/date/blank.rb
121
129
  - lib/active_support/core_ext/date/calculations.rb
122
130
  - lib/active_support/core_ext/date/conversions.rb
123
131
  - lib/active_support/core_ext/date/zones.rb
@@ -126,10 +134,10 @@ files:
126
134
  - lib/active_support/core_ext/date_and_time/zones.rb
127
135
  - lib/active_support/core_ext/date_time.rb
128
136
  - lib/active_support/core_ext/date_time/acts_like.rb
137
+ - lib/active_support/core_ext/date_time/blank.rb
129
138
  - lib/active_support/core_ext/date_time/calculations.rb
130
139
  - lib/active_support/core_ext/date_time/compatibility.rb
131
140
  - lib/active_support/core_ext/date_time/conversions.rb
132
- - lib/active_support/core_ext/date_time/zones.rb
133
141
  - lib/active_support/core_ext/digest/uuid.rb
134
142
  - lib/active_support/core_ext/enumerable.rb
135
143
  - lib/active_support/core_ext/file.rb
@@ -161,6 +169,7 @@ files:
161
169
  - lib/active_support/core_ext/module/anonymous.rb
162
170
  - lib/active_support/core_ext/module/attr_internal.rb
163
171
  - lib/active_support/core_ext/module/attribute_accessors.rb
172
+ - lib/active_support/core_ext/module/attribute_accessors_per_thread.rb
164
173
  - lib/active_support/core_ext/module/concerning.rb
165
174
  - lib/active_support/core_ext/module/delegation.rb
166
175
  - lib/active_support/core_ext/module/deprecation.rb
@@ -173,6 +182,7 @@ files:
173
182
  - lib/active_support/core_ext/numeric.rb
174
183
  - lib/active_support/core_ext/numeric/bytes.rb
175
184
  - lib/active_support/core_ext/numeric/conversions.rb
185
+ - lib/active_support/core_ext/numeric/inquiry.rb
176
186
  - lib/active_support/core_ext/numeric/time.rb
177
187
  - lib/active_support/core_ext/object.rb
178
188
  - lib/active_support/core_ext/object/acts_like.rb
@@ -182,7 +192,6 @@ files:
182
192
  - lib/active_support/core_ext/object/duplicable.rb
183
193
  - lib/active_support/core_ext/object/inclusion.rb
184
194
  - lib/active_support/core_ext/object/instance_variables.rb
185
- - lib/active_support/core_ext/object/itself.rb
186
195
  - lib/active_support/core_ext/object/json.rb
187
196
  - lib/active_support/core_ext/object/to_param.rb
188
197
  - lib/active_support/core_ext/object/to_query.rb
@@ -194,6 +203,7 @@ files:
194
203
  - lib/active_support/core_ext/range/include_range.rb
195
204
  - lib/active_support/core_ext/range/overlaps.rb
196
205
  - lib/active_support/core_ext/regexp.rb
206
+ - lib/active_support/core_ext/securerandom.rb
197
207
  - lib/active_support/core_ext/string.rb
198
208
  - lib/active_support/core_ext/string/access.rb
199
209
  - lib/active_support/core_ext/string/behavior.rb
@@ -209,7 +219,6 @@ files:
209
219
  - lib/active_support/core_ext/string/strip.rb
210
220
  - lib/active_support/core_ext/string/zones.rb
211
221
  - lib/active_support/core_ext/struct.rb
212
- - lib/active_support/core_ext/thread.rb
213
222
  - lib/active_support/core_ext/time.rb
214
223
  - lib/active_support/core_ext/time/acts_like.rb
215
224
  - lib/active_support/core_ext/time/calculations.rb
@@ -220,6 +229,7 @@ files:
220
229
  - lib/active_support/core_ext/uri.rb
221
230
  - lib/active_support/dependencies.rb
222
231
  - lib/active_support/dependencies/autoload.rb
232
+ - lib/active_support/dependencies/interlock.rb
223
233
  - lib/active_support/deprecation.rb
224
234
  - lib/active_support/deprecation/behaviors.rb
225
235
  - lib/active_support/deprecation/instance_delegator.rb
@@ -228,6 +238,11 @@ files:
228
238
  - lib/active_support/deprecation/reporting.rb
229
239
  - lib/active_support/descendants_tracker.rb
230
240
  - lib/active_support/duration.rb
241
+ - lib/active_support/duration/iso8601_parser.rb
242
+ - lib/active_support/duration/iso8601_serializer.rb
243
+ - lib/active_support/evented_file_update_checker.rb
244
+ - lib/active_support/execution_wrapper.rb
245
+ - lib/active_support/executor.rb
231
246
  - lib/active_support/file_update_checker.rb
232
247
  - lib/active_support/gem_version.rb
233
248
  - lib/active_support/gzip.rb
@@ -274,6 +289,7 @@ files:
274
289
  - lib/active_support/proxy_object.rb
275
290
  - lib/active_support/rails.rb
276
291
  - lib/active_support/railtie.rb
292
+ - lib/active_support/reloader.rb
277
293
  - lib/active_support/rescuable.rb
278
294
  - lib/active_support/security_utils.rb
279
295
  - lib/active_support/string_inquirer.rb
@@ -285,8 +301,11 @@ files:
285
301
  - lib/active_support/testing/constant_lookup.rb
286
302
  - lib/active_support/testing/declarative.rb
287
303
  - lib/active_support/testing/deprecation.rb
304
+ - lib/active_support/testing/file_fixtures.rb
288
305
  - lib/active_support/testing/isolation.rb
306
+ - lib/active_support/testing/method_call_assertions.rb
289
307
  - lib/active_support/testing/setup_and_teardown.rb
308
+ - lib/active_support/testing/stream.rb
290
309
  - lib/active_support/testing/tagged_logging.rb
291
310
  - lib/active_support/testing/time_helpers.rb
292
311
  - lib/active_support/time.rb
@@ -301,7 +320,7 @@ files:
301
320
  - lib/active_support/xml_mini/nokogiri.rb
302
321
  - lib/active_support/xml_mini/nokogirisax.rb
303
322
  - lib/active_support/xml_mini/rexml.rb
304
- homepage: http://www.rubyonrails.org
323
+ homepage: http://rubyonrails.org
305
324
  licenses:
306
325
  - MIT
307
326
  metadata: {}
@@ -315,14 +334,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
315
334
  requirements:
316
335
  - - ">="
317
336
  - !ruby/object:Gem::Version
318
- version: 1.9.3
337
+ version: 2.2.2
319
338
  required_rubygems_version: !ruby/object:Gem::Requirement
320
339
  requirements:
321
340
  - - ">="
322
341
  - !ruby/object:Gem::Version
323
342
  version: '0'
324
343
  requirements: []
325
- rubygems_version: 3.0.3
344
+ rubygems_version: 3.0.1
326
345
  signing_key:
327
346
  specification_version: 4
328
347
  summary: A toolkit of support libraries and Ruby core extensions extracted from the
@@ -1,16 +0,0 @@
1
- require 'active_support/deprecation'
2
-
3
- ActiveSupport::Deprecation.warn 'core_ext/big_decimal/yaml_conversions is deprecated and will be removed in the future.'
4
-
5
- require 'bigdecimal'
6
- require 'yaml'
7
- require 'active_support/core_ext/big_decimal/conversions'
8
-
9
- class BigDecimal
10
- YAML_MAPPING = { 'Infinity' => '.Inf', '-Infinity' => '-.Inf', 'NaN' => '.NaN' }
11
-
12
- def encode_with(coder)
13
- string = to_s
14
- coder.represent_scalar(nil, YAML_MAPPING[string] || string)
15
- end
16
- end
@@ -1,45 +0,0 @@
1
- require 'active_support/core_ext/kernel/singleton_class'
2
- require 'active_support/core_ext/module/remove_method'
3
- require 'active_support/core_ext/module/deprecation'
4
-
5
-
6
- class Class
7
- def superclass_delegating_accessor(name, options = {})
8
- # Create private _name and _name= methods that can still be used if the public
9
- # methods are overridden.
10
- _superclass_delegating_accessor("_#{name}", options)
11
-
12
- # Generate the public methods name, name=, and name?.
13
- # These methods dispatch to the private _name, and _name= methods, making them
14
- # overridable.
15
- singleton_class.send(:define_method, name) { send("_#{name}") }
16
- singleton_class.send(:define_method, "#{name}?") { !!send("_#{name}") }
17
- singleton_class.send(:define_method, "#{name}=") { |value| send("_#{name}=", value) }
18
-
19
- # If an instance_reader is needed, generate public instance methods name and name?.
20
- if options[:instance_reader] != false
21
- define_method(name) { send("_#{name}") }
22
- define_method("#{name}?") { !!send("#{name}") }
23
- end
24
- end
25
-
26
- deprecate superclass_delegating_accessor: :class_attribute
27
-
28
- private
29
- # Take the object being set and store it in a method. This gives us automatic
30
- # inheritance behavior, without having to store the object in an instance
31
- # variable and look up the superclass chain manually.
32
- def _stash_object_in_method(object, method, instance_reader = true)
33
- singleton_class.remove_possible_method(method)
34
- singleton_class.send(:define_method, method) { object }
35
- remove_possible_method(method)
36
- define_method(method) { object } if instance_reader
37
- end
38
-
39
- def _superclass_delegating_accessor(name, options = {})
40
- singleton_class.send(:define_method, "#{name}=") do |value|
41
- _stash_object_in_method(value, name, options[:instance_reader] != false)
42
- end
43
- send("#{name}=", nil)
44
- end
45
- end
@@ -1,6 +0,0 @@
1
- require 'date'
2
- require 'active_support/core_ext/date_and_time/zones'
3
-
4
- class DateTime
5
- include DateAndTime::Zones
6
- end
@@ -1,15 +0,0 @@
1
- class Object
2
- # TODO: Remove this file when we drop support for Ruby < 2.2
3
- unless respond_to?(:itself)
4
- # Returns the object itself.
5
- #
6
- # Useful for chaining methods, such as Active Record scopes:
7
- #
8
- # Event.public_send(state.presence_in([ :trashed, :drafted ]) || :itself).order(:created_at)
9
- #
10
- # @return Object
11
- def itself
12
- self
13
- end
14
- end
15
- end
@@ -1,86 +0,0 @@
1
- class Thread
2
- LOCK = Mutex.new # :nodoc:
3
-
4
- # Returns the value of a thread local variable that has been set. Note that
5
- # these are different than fiber local values.
6
- #
7
- # Thread local values are carried along with threads, and do not respect
8
- # fibers. For example:
9
- #
10
- # Thread.new {
11
- # Thread.current.thread_variable_set("foo", "bar") # set a thread local
12
- # Thread.current["foo"] = "bar" # set a fiber local
13
- #
14
- # Fiber.new {
15
- # Fiber.yield [
16
- # Thread.current.thread_variable_get("foo"), # get the thread local
17
- # Thread.current["foo"], # get the fiber local
18
- # ]
19
- # }.resume
20
- # }.join.value # => ['bar', nil]
21
- #
22
- # The value <tt>"bar"</tt> is returned for the thread local, where +nil+ is returned
23
- # for the fiber local. The fiber is executed in the same thread, so the
24
- # thread local values are available.
25
- def thread_variable_get(key)
26
- _locals[key.to_sym]
27
- end
28
-
29
- # Sets a thread local with +key+ to +value+. Note that these are local to
30
- # threads, and not to fibers. Please see Thread#thread_variable_get for
31
- # more information.
32
- def thread_variable_set(key, value)
33
- _locals[key.to_sym] = value
34
- end
35
-
36
- # Returns an array of the names of the thread-local variables (as Symbols).
37
- #
38
- # thr = Thread.new do
39
- # Thread.current.thread_variable_set(:cat, 'meow')
40
- # Thread.current.thread_variable_set("dog", 'woof')
41
- # end
42
- # thr.join # => #<Thread:0x401b3f10 dead>
43
- # thr.thread_variables # => [:dog, :cat]
44
- #
45
- # Note that these are not fiber local variables. Please see Thread#thread_variable_get
46
- # for more details.
47
- def thread_variables
48
- _locals.keys
49
- end
50
-
51
- # Returns <tt>true</tt> if the given string (or symbol) exists as a
52
- # thread-local variable.
53
- #
54
- # me = Thread.current
55
- # me.thread_variable_set(:oliver, "a")
56
- # me.thread_variable?(:oliver) # => true
57
- # me.thread_variable?(:stanley) # => false
58
- #
59
- # Note that these are not fiber local variables. Please see Thread#thread_variable_get
60
- # for more details.
61
- def thread_variable?(key)
62
- _locals.has_key?(key.to_sym)
63
- end
64
-
65
- # Freezes the thread so that thread local variables cannot be set via
66
- # Thread#thread_variable_set, nor can fiber local variables be set.
67
- #
68
- # me = Thread.current
69
- # me.freeze
70
- # me.thread_variable_set(:oliver, "a") #=> RuntimeError: can't modify frozen thread locals
71
- # me[:oliver] = "a" #=> RuntimeError: can't modify frozen thread locals
72
- def freeze
73
- _locals.freeze
74
- super
75
- end
76
-
77
- private
78
-
79
- def _locals
80
- if defined?(@_locals)
81
- @_locals
82
- else
83
- LOCK.synchronize { @_locals ||= {} }
84
- end
85
- end
86
- end unless Thread.instance_methods.include?(:thread_variable_set)