activesupport 6.1.3.1 → 7.0.0.alpha1

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 (131) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +151 -485
  3. data/MIT-LICENSE +1 -1
  4. data/lib/active_support/actionable_error.rb +1 -1
  5. data/lib/active_support/array_inquirer.rb +0 -2
  6. data/lib/active_support/benchmarkable.rb +2 -2
  7. data/lib/active_support/cache/file_store.rb +16 -10
  8. data/lib/active_support/cache/mem_cache_store.rb +119 -28
  9. data/lib/active_support/cache/memory_store.rb +21 -13
  10. data/lib/active_support/cache/null_store.rb +10 -2
  11. data/lib/active_support/cache/redis_cache_store.rb +39 -59
  12. data/lib/active_support/cache/strategy/local_cache.rb +29 -49
  13. data/lib/active_support/cache.rb +196 -46
  14. data/lib/active_support/callbacks.rb +35 -31
  15. data/lib/active_support/concern.rb +5 -5
  16. data/lib/active_support/concurrency/load_interlock_aware_monitor.rb +2 -4
  17. data/lib/active_support/concurrency/share_lock.rb +2 -2
  18. data/lib/active_support/configurable.rb +6 -3
  19. data/lib/active_support/configuration_file.rb +7 -2
  20. data/lib/active_support/core_ext/array/access.rb +1 -5
  21. data/lib/active_support/core_ext/array/conversions.rb +6 -6
  22. data/lib/active_support/core_ext/array/grouping.rb +6 -6
  23. data/lib/active_support/core_ext/big_decimal/conversions.rb +1 -1
  24. data/lib/active_support/core_ext/date/blank.rb +1 -1
  25. data/lib/active_support/core_ext/date/calculations.rb +2 -2
  26. data/lib/active_support/core_ext/date_time/blank.rb +1 -1
  27. data/lib/active_support/core_ext/digest/uuid.rb +13 -12
  28. data/lib/active_support/core_ext/enumerable.rb +64 -12
  29. data/lib/active_support/core_ext/file/atomic.rb +1 -1
  30. data/lib/active_support/core_ext/hash/keys.rb +1 -1
  31. data/lib/active_support/core_ext/kernel/reporting.rb +4 -4
  32. data/lib/active_support/core_ext/module/delegation.rb +2 -8
  33. data/lib/active_support/core_ext/name_error.rb +2 -8
  34. data/lib/active_support/core_ext/numeric/conversions.rb +2 -2
  35. data/lib/active_support/core_ext/object/blank.rb +2 -2
  36. data/lib/active_support/core_ext/object/deep_dup.rb +1 -1
  37. data/lib/active_support/core_ext/object/duplicable.rb +11 -0
  38. data/lib/active_support/core_ext/object/json.rb +29 -24
  39. data/lib/active_support/core_ext/object/to_query.rb +2 -2
  40. data/lib/active_support/core_ext/object/try.rb +20 -20
  41. data/lib/active_support/core_ext/range/compare_range.rb +0 -25
  42. data/lib/active_support/core_ext/range/each.rb +1 -1
  43. data/lib/active_support/core_ext/range/include_time_with_zone.rb +1 -1
  44. data/lib/active_support/core_ext/string/filters.rb +1 -1
  45. data/lib/active_support/core_ext/string/inflections.rb +1 -1
  46. data/lib/active_support/core_ext/string/output_safety.rb +60 -36
  47. data/lib/active_support/core_ext/symbol/starts_ends_with.rb +0 -8
  48. data/lib/active_support/core_ext/time/calculations.rb +5 -9
  49. data/lib/active_support/core_ext/time/zones.rb +2 -17
  50. data/lib/active_support/core_ext/uri.rb +1 -15
  51. data/lib/active_support/current_attributes.rb +18 -1
  52. data/lib/active_support/dependencies/interlock.rb +10 -18
  53. data/lib/active_support/dependencies/require_dependency.rb +28 -0
  54. data/lib/active_support/dependencies.rb +58 -788
  55. data/lib/active_support/deprecation/behaviors.rb +4 -1
  56. data/lib/active_support/deprecation/method_wrappers.rb +3 -3
  57. data/lib/active_support/deprecation/proxy_wrappers.rb +1 -1
  58. data/lib/active_support/deprecation.rb +1 -1
  59. data/lib/active_support/descendants_tracker.rb +12 -9
  60. data/lib/active_support/digest.rb +5 -3
  61. data/lib/active_support/duration/iso8601_parser.rb +3 -3
  62. data/lib/active_support/duration/iso8601_serializer.rb +9 -1
  63. data/lib/active_support/duration.rb +77 -48
  64. data/lib/active_support/encrypted_configuration.rb +11 -1
  65. data/lib/active_support/encrypted_file.rb +1 -1
  66. data/lib/active_support/environment_inquirer.rb +1 -1
  67. data/lib/active_support/evented_file_update_checker.rb +1 -1
  68. data/lib/active_support/fork_tracker.rb +2 -2
  69. data/lib/active_support/gem_version.rb +4 -4
  70. data/lib/active_support/hash_with_indifferent_access.rb +8 -1
  71. data/lib/active_support/i18n.rb +1 -0
  72. data/lib/active_support/inflector/inflections.rb +11 -4
  73. data/lib/active_support/inflector/methods.rb +23 -47
  74. data/lib/active_support/json/encoding.rb +3 -3
  75. data/lib/active_support/key_generator.rb +18 -1
  76. data/lib/active_support/locale/en.yml +2 -2
  77. data/lib/active_support/log_subscriber.rb +13 -3
  78. data/lib/active_support/logger_thread_safe_level.rb +5 -13
  79. data/lib/active_support/message_encryptor.rb +3 -3
  80. data/lib/active_support/message_verifier.rb +4 -4
  81. data/lib/active_support/messages/metadata.rb +2 -2
  82. data/lib/active_support/multibyte/chars.rb +10 -11
  83. data/lib/active_support/multibyte/unicode.rb +2 -2
  84. data/lib/active_support/multibyte.rb +1 -1
  85. data/lib/active_support/notifications/fanout.rb +31 -11
  86. data/lib/active_support/notifications/instrumenter.rb +17 -0
  87. data/lib/active_support/notifications.rb +10 -0
  88. data/lib/active_support/number_helper/number_converter.rb +1 -3
  89. data/lib/active_support/number_helper/number_to_currency_converter.rb +11 -6
  90. data/lib/active_support/number_helper/number_to_delimited_converter.rb +1 -1
  91. data/lib/active_support/number_helper/number_to_human_size_converter.rb +1 -1
  92. data/lib/active_support/number_helper/number_to_phone_converter.rb +1 -1
  93. data/lib/active_support/number_helper/number_to_rounded_converter.rb +10 -6
  94. data/lib/active_support/number_helper/rounding_helper.rb +2 -6
  95. data/lib/active_support/number_helper.rb +0 -2
  96. data/lib/active_support/option_merger.rb +4 -16
  97. data/lib/active_support/ordered_hash.rb +1 -1
  98. data/lib/active_support/parameter_filter.rb +5 -0
  99. data/lib/active_support/per_thread_registry.rb +1 -0
  100. data/lib/active_support/railtie.rb +34 -11
  101. data/lib/active_support/rescuable.rb +2 -2
  102. data/lib/active_support/secure_compare_rotator.rb +1 -1
  103. data/lib/active_support/security_utils.rb +1 -1
  104. data/lib/active_support/string_inquirer.rb +0 -2
  105. data/lib/active_support/subscriber.rb +5 -0
  106. data/lib/active_support/tagged_logging.rb +1 -1
  107. data/lib/active_support/test_case.rb +9 -21
  108. data/lib/active_support/testing/assertions.rb +35 -5
  109. data/lib/active_support/testing/deprecation.rb +1 -1
  110. data/lib/active_support/testing/isolation.rb +1 -1
  111. data/lib/active_support/testing/method_call_assertions.rb +5 -5
  112. data/lib/active_support/testing/parallelization/server.rb +4 -0
  113. data/lib/active_support/testing/parallelization/worker.rb +3 -0
  114. data/lib/active_support/testing/parallelization.rb +4 -0
  115. data/lib/active_support/testing/parallelize_executor.rb +76 -0
  116. data/lib/active_support/testing/stream.rb +3 -5
  117. data/lib/active_support/testing/tagged_logging.rb +1 -1
  118. data/lib/active_support/testing/time_helpers.rb +13 -2
  119. data/lib/active_support/time_with_zone.rb +19 -6
  120. data/lib/active_support/values/time_zone.rb +25 -9
  121. data/lib/active_support/xml_mini/jdom.rb +1 -1
  122. data/lib/active_support/xml_mini/libxml.rb +5 -5
  123. data/lib/active_support/xml_mini/libxmlsax.rb +1 -1
  124. data/lib/active_support/xml_mini/nokogiri.rb +4 -4
  125. data/lib/active_support/xml_mini/nokogirisax.rb +1 -1
  126. data/lib/active_support/xml_mini/rexml.rb +1 -1
  127. data/lib/active_support/xml_mini.rb +2 -1
  128. data/lib/active_support.rb +14 -1
  129. metadata +11 -25
  130. data/lib/active_support/core_ext/marshal.rb +0 -26
  131. data/lib/active_support/dependencies/zeitwerk_integration.rb +0 -117
@@ -4,6 +4,10 @@ module Enumerable
4
4
  INDEX_WITH_DEFAULT = Object.new
5
5
  private_constant :INDEX_WITH_DEFAULT
6
6
 
7
+ # Error generated by +sole+ when called on an enumerable that doesn't have
8
+ # exactly one item.
9
+ class SoleItemExpectedError < StandardError; end
10
+
7
11
  # Enumerable#sum was added in Ruby 2.4, but it only works with Numeric elements
8
12
  # when we omit an identity.
9
13
 
@@ -16,6 +20,22 @@ module Enumerable
16
20
 
17
21
  # :startdoc:
18
22
 
23
+ # Calculates the minimum from the extracted elements.
24
+ #
25
+ # payments = [Payment.new(5), Payment.new(15), Payment.new(10)]
26
+ # payments.minimum(:price) # => 5
27
+ def minimum(key)
28
+ map(&key).min
29
+ end
30
+
31
+ # Calculates the maximum from the extracted elements.
32
+ #
33
+ # payments = [Payment.new(5), Payment.new(15), Payment.new(10)]
34
+ # payments.maximum(:price) # => 15
35
+ def maximum(key)
36
+ map(&key).max
37
+ end
38
+
19
39
  # Calculates a sum from the elements.
20
40
  #
21
41
  # payments.sum { |p| p.price * p.tax_rate }
@@ -28,8 +48,8 @@ module Enumerable
28
48
  # It can also calculate the sum without the use of a block.
29
49
  #
30
50
  # [5, 15, 10].sum # => 30
31
- # ['foo', 'bar'].sum # => "foobar"
32
- # [[1, 2], [3, 1, 5]].sum # => [1, 2, 3, 1, 5]
51
+ # ['foo', 'bar'].sum('') # => "foobar"
52
+ # [[1, 2], [3, 1, 5]].sum([]) # => [1, 2, 3, 1, 5]
33
53
  #
34
54
  # The default sum of an empty list is zero. You can override this default:
35
55
  #
@@ -38,8 +58,19 @@ module Enumerable
38
58
  if identity
39
59
  _original_sum_with_required_identity(identity, &block)
40
60
  elsif block_given?
41
- map(&block).sum(identity)
61
+ map(&block).sum
62
+ # we check `first(1) == []` to check if we have an
63
+ # empty Enumerable; checking `empty?` would return
64
+ # true for `[nil]`, which we want to deprecate to
65
+ # keep consistent with Ruby
66
+ elsif first.is_a?(Numeric) || first(1) == []
67
+ identity ||= 0
68
+ _original_sum_with_required_identity(identity, &block)
42
69
  else
70
+ ActiveSupport::Deprecation.warn(<<-MSG.squish)
71
+ Rails 7.0 has deprecated Enumerable.sum in favor of Ruby's native implementation available since 2.4.
72
+ Sum of non-numeric elements requires an initial argument.
73
+ MSG
43
74
  inject(:+) || 0
44
75
  end
45
76
  end
@@ -136,11 +167,7 @@ module Enumerable
136
167
  elements.flatten!(1)
137
168
  reject { |element| elements.include?(element) }
138
169
  end
139
-
140
- # Alias for #excluding.
141
- def without(*elements)
142
- excluding(*elements)
143
- end
170
+ alias :without :excluding
144
171
 
145
172
  # Extract the given key from each element in the enumerable.
146
173
  #
@@ -191,11 +218,37 @@ module Enumerable
191
218
  def compact_blank
192
219
  reject(&:blank?)
193
220
  end
221
+
222
+ # Returns a new +Array+ where the order has been set to that provided in the +series+, based on the +key+ of the
223
+ # objects in the original enumerable.
224
+ #
225
+ # [ Person.find(5), Person.find(3), Person.find(1) ].in_order_of(:id, [ 1, 5, 3 ])
226
+ # => [ Person.find(1), Person.find(5), Person.find(3) ]
227
+ #
228
+ # If the +series+ include keys that have no corresponding element in the Enumerable, these are ignored.
229
+ # If the Enumerable has additional elements that aren't named in the +series+, these are not included in the result.
230
+ def in_order_of(key, series)
231
+ index_by(&key).values_at(*series).compact
232
+ end
233
+
234
+ # Returns the sole item in the enumerable. If there are no items, or more
235
+ # than one item, raises +Enumerable::SoleItemExpectedError+.
236
+ #
237
+ # ["x"].sole # => "x"
238
+ # Set.new.sole # => Enumerable::SoleItemExpectedError: no item found
239
+ # { a: 1, b: 2 }.sole # => Enumerable::SoleItemExpectedError: multiple items found
240
+ def sole
241
+ case count
242
+ when 1 then return first # rubocop:disable Style/RedundantReturn
243
+ when 0 then raise SoleItemExpectedError, "no item found"
244
+ when 2.. then raise SoleItemExpectedError, "multiple items found"
245
+ end
246
+ end
194
247
  end
195
248
 
196
249
  class Hash
197
250
  # Hash#reject has its own definition, so this needs one too.
198
- def compact_blank #:nodoc:
251
+ def compact_blank # :nodoc:
199
252
  reject { |_k, v| v.blank? }
200
253
  end
201
254
 
@@ -211,7 +264,7 @@ class Hash
211
264
  end
212
265
  end
213
266
 
214
- class Range #:nodoc:
267
+ class Range # :nodoc:
215
268
  # Optimize range sum to use arithmetic progression if a block is not given and
216
269
  # we have a range of numeric values.
217
270
  def sum(identity = nil)
@@ -236,8 +289,7 @@ using Module.new {
236
289
  end
237
290
  }
238
291
 
239
- class Array #:nodoc:
240
- # Array#sum was added in Ruby 2.4 but it only works with Numeric elements.
292
+ class Array # :nodoc:
241
293
  def sum(init = nil, &block)
242
294
  if init.is_a?(Numeric) || first.is_a?(Numeric)
243
295
  init ||= 0
@@ -53,7 +53,7 @@ class File
53
53
  end
54
54
 
55
55
  # Private utility method.
56
- def self.probe_stat_in(dir) #:nodoc:
56
+ def self.probe_stat_in(dir) # :nodoc:
57
57
  basename = [
58
58
  ".permissions_check",
59
59
  Thread.current.object_id,
@@ -116,7 +116,7 @@ class Hash
116
116
  def _deep_transform_keys_in_object(object, &block)
117
117
  case object
118
118
  when Hash
119
- object.each_with_object({}) do |(key, value), result|
119
+ object.each_with_object(self.class.new) do |(key, value), result|
120
120
  result[yield(key)] = _deep_transform_keys_in_object(value, &block)
121
121
  end
122
122
  when Array
@@ -11,14 +11,14 @@ module Kernel
11
11
  # end
12
12
  #
13
13
  # noisy_call # warning voiced
14
- def silence_warnings
15
- with_warnings(nil) { yield }
14
+ def silence_warnings(&block)
15
+ with_warnings(nil, &block)
16
16
  end
17
17
 
18
18
  # Sets $VERBOSE to +true+ for the duration of the block and back to its
19
19
  # original value afterwards.
20
- def enable_warnings
21
- with_warnings(true) { yield }
20
+ def enable_warnings(&block)
21
+ with_warnings(true, &block)
22
22
  end
23
23
 
24
24
  # Sets $VERBOSE for the duration of the block and back to its original
@@ -199,13 +199,7 @@ class Module
199
199
 
200
200
  # Attribute writer methods only accept one argument. Makes sure []=
201
201
  # methods still accept two arguments.
202
- definition = if /[^\]]=$/.match?(method)
203
- "arg"
204
- elsif RUBY_VERSION >= "2.7"
205
- "..."
206
- else
207
- "*args, &block"
208
- end
202
+ definition = /[^\]]=\z/.match?(method) ? "arg" : "..."
209
203
 
210
204
  # The following generated method calls the target exactly once, storing
211
205
  # the returned value in a dummy variable.
@@ -324,7 +318,7 @@ class Module
324
318
  end
325
319
  end
326
320
  end
327
- ruby2_keywords(:method_missing) if respond_to?(:ruby2_keywords, true)
321
+ ruby2_keywords(:method_missing)
328
322
  RUBY
329
323
  end
330
324
  end
@@ -53,13 +53,7 @@ class NameError
53
53
  UNBOUND_METHOD_MODULE_NAME = Module.instance_method(:name)
54
54
  private_constant :UNBOUND_METHOD_MODULE_NAME
55
55
 
56
- if UnboundMethod.method_defined?(:bind_call)
57
- def real_mod_name(mod)
58
- UNBOUND_METHOD_MODULE_NAME.bind_call(mod)
59
- end
60
- else
61
- def real_mod_name(mod)
62
- UNBOUND_METHOD_MODULE_NAME.bind(mod).call
63
- end
56
+ def real_mod_name(mod)
57
+ UNBOUND_METHOD_MODULE_NAME.bind_call(mod)
64
58
  end
65
59
  end
@@ -107,9 +107,9 @@ module ActiveSupport
107
107
  # separator: ',',
108
108
  # significant: false) # => "1,2 Million"
109
109
  def to_s(format = nil, options = nil)
110
+ return super() if format.nil?
111
+
110
112
  case format
111
- when nil
112
- super()
113
113
  when Integer, String
114
114
  super(format)
115
115
  when :phone
@@ -131,7 +131,7 @@ class String
131
131
  end
132
132
  end
133
133
 
134
- class Numeric #:nodoc:
134
+ class Numeric # :nodoc:
135
135
  # No number is blank:
136
136
  #
137
137
  # 1.blank? # => false
@@ -143,7 +143,7 @@ class Numeric #:nodoc:
143
143
  end
144
144
  end
145
145
 
146
- class Time #:nodoc:
146
+ class Time # :nodoc:
147
147
  # No Time is blank:
148
148
  #
149
149
  # Time.now.blank? # => false
@@ -43,7 +43,7 @@ class Hash
43
43
  def deep_dup
44
44
  hash = dup
45
45
  each_pair do |key, value|
46
- if (::String === key && key.frozen?) || ::Symbol === key
46
+ if ::String === key || ::Symbol === key
47
47
  hash[key] = value.deep_dup
48
48
  else
49
49
  hash.delete(key)
@@ -47,3 +47,14 @@ class UnboundMethod
47
47
  false
48
48
  end
49
49
  end
50
+
51
+ require "singleton"
52
+
53
+ module Singleton
54
+ # Singleton instances are not duplicable:
55
+ #
56
+ # Class.new.include(Singleton).instance.dup # TypeError (can't dup instance of singleton
57
+ def duplicable?
58
+ false
59
+ end
60
+ end
@@ -19,8 +19,7 @@ require "active_support/core_ext/date/conversions"
19
19
  # The JSON gem adds a few modules to Ruby core classes containing :to_json definition, overwriting
20
20
  # their default behavior. That said, we need to define the basic to_json method in all of them,
21
21
  # otherwise they will always use to_json gem implementation, which is backwards incompatible in
22
- # several cases (for instance, the JSON implementation for Hash does not work) with inheritance
23
- # and consequently classes as ActiveSupport::OrderedHash cannot be serialized to json.
22
+ # several cases (for instance, the JSON implementation for Hash does not work) with inheritance.
24
23
  #
25
24
  # On the other hand, we should avoid conflict with ::JSON.{generate,dump}(obj). Unfortunately, the
26
25
  # JSON gem's encoder relies on its own to_json implementation to encode objects. Since it always
@@ -50,8 +49,14 @@ end
50
49
  klass.prepend(ActiveSupport::ToJsonWithActiveSupportEncoder)
51
50
  end
52
51
 
52
+ class Module
53
+ def as_json(options = nil) # :nodoc:
54
+ name
55
+ end
56
+ end
57
+
53
58
  class Object
54
- def as_json(options = nil) #:nodoc:
59
+ def as_json(options = nil) # :nodoc:
55
60
  if respond_to?(:to_hash)
56
61
  to_hash.as_json(options)
57
62
  else
@@ -60,44 +65,44 @@ class Object
60
65
  end
61
66
  end
62
67
 
63
- class Struct #:nodoc:
68
+ class Struct # :nodoc:
64
69
  def as_json(options = nil)
65
70
  Hash[members.zip(values)].as_json(options)
66
71
  end
67
72
  end
68
73
 
69
74
  class TrueClass
70
- def as_json(options = nil) #:nodoc:
75
+ def as_json(options = nil) # :nodoc:
71
76
  self
72
77
  end
73
78
  end
74
79
 
75
80
  class FalseClass
76
- def as_json(options = nil) #:nodoc:
81
+ def as_json(options = nil) # :nodoc:
77
82
  self
78
83
  end
79
84
  end
80
85
 
81
86
  class NilClass
82
- def as_json(options = nil) #:nodoc:
87
+ def as_json(options = nil) # :nodoc:
83
88
  self
84
89
  end
85
90
  end
86
91
 
87
92
  class String
88
- def as_json(options = nil) #:nodoc:
93
+ def as_json(options = nil) # :nodoc:
89
94
  self
90
95
  end
91
96
  end
92
97
 
93
98
  class Symbol
94
- def as_json(options = nil) #:nodoc:
99
+ def as_json(options = nil) # :nodoc:
95
100
  to_s
96
101
  end
97
102
  end
98
103
 
99
104
  class Numeric
100
- def as_json(options = nil) #:nodoc:
105
+ def as_json(options = nil) # :nodoc:
101
106
  self
102
107
  end
103
108
  end
@@ -105,7 +110,7 @@ end
105
110
  class Float
106
111
  # Encoding Infinity or NaN to JSON should return "null". The default returns
107
112
  # "Infinity" or "NaN" which are not valid JSON.
108
- def as_json(options = nil) #:nodoc:
113
+ def as_json(options = nil) # :nodoc:
109
114
  finite? ? self : nil
110
115
  end
111
116
  end
@@ -120,43 +125,43 @@ class BigDecimal
120
125
  # if the other end knows by contract that the data is supposed to be a
121
126
  # BigDecimal, it still has the chance to post-process the string and get the
122
127
  # real value.
123
- def as_json(options = nil) #:nodoc:
128
+ def as_json(options = nil) # :nodoc:
124
129
  finite? ? to_s : nil
125
130
  end
126
131
  end
127
132
 
128
133
  class Regexp
129
- def as_json(options = nil) #:nodoc:
134
+ def as_json(options = nil) # :nodoc:
130
135
  to_s
131
136
  end
132
137
  end
133
138
 
134
139
  module Enumerable
135
- def as_json(options = nil) #:nodoc:
140
+ def as_json(options = nil) # :nodoc:
136
141
  to_a.as_json(options)
137
142
  end
138
143
  end
139
144
 
140
145
  class IO
141
- def as_json(options = nil) #:nodoc:
146
+ def as_json(options = nil) # :nodoc:
142
147
  to_s
143
148
  end
144
149
  end
145
150
 
146
151
  class Range
147
- def as_json(options = nil) #:nodoc:
152
+ def as_json(options = nil) # :nodoc:
148
153
  to_s
149
154
  end
150
155
  end
151
156
 
152
157
  class Array
153
- def as_json(options = nil) #:nodoc:
158
+ def as_json(options = nil) # :nodoc:
154
159
  map { |v| options ? v.as_json(options.dup) : v.as_json }
155
160
  end
156
161
  end
157
162
 
158
163
  class Hash
159
- def as_json(options = nil) #:nodoc:
164
+ def as_json(options = nil) # :nodoc:
160
165
  # create a subset of the hash by applying :only or :except
161
166
  subset = if options
162
167
  if attrs = options[:only]
@@ -179,7 +184,7 @@ class Hash
179
184
  end
180
185
 
181
186
  class Time
182
- def as_json(options = nil) #:nodoc:
187
+ def as_json(options = nil) # :nodoc:
183
188
  if ActiveSupport::JSON::Encoding.use_standard_json_time_format
184
189
  xmlschema(ActiveSupport::JSON::Encoding.time_precision)
185
190
  else
@@ -189,7 +194,7 @@ class Time
189
194
  end
190
195
 
191
196
  class Date
192
- def as_json(options = nil) #:nodoc:
197
+ def as_json(options = nil) # :nodoc:
193
198
  if ActiveSupport::JSON::Encoding.use_standard_json_time_format
194
199
  strftime("%Y-%m-%d")
195
200
  else
@@ -199,7 +204,7 @@ class Date
199
204
  end
200
205
 
201
206
  class DateTime
202
- def as_json(options = nil) #:nodoc:
207
+ def as_json(options = nil) # :nodoc:
203
208
  if ActiveSupport::JSON::Encoding.use_standard_json_time_format
204
209
  xmlschema(ActiveSupport::JSON::Encoding.time_precision)
205
210
  else
@@ -208,13 +213,13 @@ class DateTime
208
213
  end
209
214
  end
210
215
 
211
- class URI::Generic #:nodoc:
216
+ class URI::Generic # :nodoc:
212
217
  def as_json(options = nil)
213
218
  to_s
214
219
  end
215
220
  end
216
221
 
217
- class Pathname #:nodoc:
222
+ class Pathname # :nodoc:
218
223
  def as_json(options = nil)
219
224
  to_s
220
225
  end
@@ -226,7 +231,7 @@ class IPAddr # :nodoc:
226
231
  end
227
232
  end
228
233
 
229
- class Process::Status #:nodoc:
234
+ class Process::Status # :nodoc:
230
235
  def as_json(options = nil)
231
236
  { exitstatus: exitstatus, pid: pid }
232
237
  end