activesupport 7.0.1 → 7.0.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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f715e893b36942a3dd53bfdff6e441c8f2ec5aca48afe3b52b7b0592fd390f73
4
- data.tar.gz: 796c266dacba0ee5373285437c0deb231a17dfa4ac1f071324061253d5f4c3cd
3
+ metadata.gz: 7da227e95099973079d2282889ff40058c260d0366cef712e1d5190bd7ac4d38
4
+ data.tar.gz: 1f8b5198b25668a2baa1d77168e27b821c6afccaa6117cadc5c50dba1b852f2d
5
5
  SHA512:
6
- metadata.gz: 9567947d9506c123e68d78647f4912c4e21a957d014d0a7fca8cd37c72b06319f4c4849bb30a36205d5b0de73ef0837b97b86f5b43b68fa8b5fd6281c80fc7d3
7
- data.tar.gz: 6da1c1833eedd6810577887eb28385c1a97ac61a7982ac7589a05717b73f42ae838f43228d54b0eb991bf7c9927935eb01ca8cc9f79772c572f1bae609ca9f12
6
+ metadata.gz: 901dcaca03cc045ac9b284468f5a875d6db1aaa610f3aaaaf473199e766baae9bfccfd8372c6ce2ba6c496383338928ff584ad494b59dc901f530ceadd22df22
7
+ data.tar.gz: fe4f98525e6453eb9e8e858092e11458fb4f35cd0883dde01826ebb96cf0d926c1fae323ad16ba153bc19ca13e2dfbd658bec49f31af75a50768b9f0a4eb248b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## Rails 7.0.2 (February 08, 2022) ##
2
+
3
+ * Fix `ActiveSupport::EncryptedConfiguration` to be compatible with Psych 4
4
+
5
+ *Stephen Sugden*
6
+
7
+ * Improve `File.atomic_write` error handling.
8
+
9
+ *Daniel Pepper*
10
+
11
+
1
12
  ## Rails 7.0.1 (January 06, 2022) ##
2
13
 
3
14
  * Fix `Class#descendants` and `DescendantsTracker#descendants` compatibility with Ruby 3.1.
@@ -87,12 +87,12 @@ class Array
87
87
  # Extends <tt>Array#to_s</tt> to convert a collection of elements into a
88
88
  # comma separated id list if <tt>:db</tt> argument is given as the format.
89
89
  #
90
- # This method is aliased to <tt>to_fs</tt>.
90
+ # This method is aliased to <tt>to_formatted_s</tt>.
91
91
  #
92
- # Blog.all.to_formatted_s(:db) # => "1,2,3"
93
- # Blog.none.to_formatted_s(:db) # => "null"
94
- # [1,2].to_formatted_s # => "[1, 2]"
95
- def to_formatted_s(format = :default)
92
+ # Blog.all.to_fs(:db) # => "1,2,3"
93
+ # Blog.none.to_fs(:db) # => "null"
94
+ # [1,2].to_fs # => "[1, 2]"
95
+ def to_fs(format = :default)
96
96
  case format
97
97
  when :db
98
98
  if empty?
@@ -104,7 +104,7 @@ class Array
104
104
  to_default_s
105
105
  end
106
106
  end
107
- alias_method :to_fs, :to_formatted_s
107
+ alias_method :to_formatted_s, :to_fs
108
108
  alias_method :to_default_s, :to_s
109
109
 
110
110
  # Returns a string that represents the array in XML by invoking +to_xml+
@@ -6,7 +6,7 @@ class Array
6
6
  case format
7
7
  when :db
8
8
  ActiveSupport::Deprecation.warn(
9
- "Array#to_s(#{format.inspect}) is deprecated. Please use Array#to_formatted_s(#{format.inspect}) instead."
9
+ "Array#to_s(#{format.inspect}) is deprecated. Please use Array#to_fs(#{format.inspect}) instead."
10
10
  )
11
11
  if empty?
12
12
  "null"
@@ -17,7 +17,7 @@ class Array
17
17
  to_default_s
18
18
  else
19
19
  ActiveSupport::Deprecation.warn(
20
- "Array#to_s(#{format.inspect}) is deprecated. Please use Array#to_formatted_s(#{format.inspect}) instead."
20
+ "Array#to_s(#{format.inspect}) is deprecated. Please use Array#to_fs(#{format.inspect}) instead."
21
21
  )
22
22
  to_default_s
23
23
  end
@@ -4,10 +4,6 @@ require "active_support/ruby_features"
4
4
 
5
5
  class Class
6
6
  if ActiveSupport::RubyFeatures::CLASS_SUBCLASSES
7
- def descendants
8
- subclasses.concat(subclasses.flat_map(&:descendants))
9
- end
10
- else
11
7
  # Returns an array with all classes that are < than its receiver.
12
8
  #
13
9
  # class C; end
@@ -21,6 +17,10 @@ class Class
21
17
  #
22
18
  # class D < C; end
23
19
  # C.descendants # => [B, A, D]
20
+ def descendants
21
+ subclasses.concat(subclasses.flat_map(&:descendants))
22
+ end
23
+ else
24
24
  def descendants
25
25
  ObjectSpace.each_object(singleton_class).reject do |k|
26
26
  k.singleton_class? || k == self
@@ -22,21 +22,21 @@ class Date
22
22
 
23
23
  # Convert to a formatted string. See DATE_FORMATS for predefined formats.
24
24
  #
25
- # This method is aliased to <tt>to_fs</tt>.
25
+ # This method is aliased to <tt>to_formatted_s</tt>.
26
26
  #
27
27
  # date = Date.new(2007, 11, 10) # => Sat, 10 Nov 2007
28
28
  #
29
- # date.to_formatted_s(:db) # => "2007-11-10"
30
29
  # date.to_fs(:db) # => "2007-11-10"
30
+ # date.to_formatted_s(:db) # => "2007-11-10"
31
31
  #
32
- # date.to_formatted_s(:short) # => "10 Nov"
33
- # date.to_formatted_s(:number) # => "20071110"
34
- # date.to_formatted_s(:long) # => "November 10, 2007"
35
- # date.to_formatted_s(:long_ordinal) # => "November 10th, 2007"
36
- # date.to_formatted_s(:rfc822) # => "10 Nov 2007"
37
- # date.to_formatted_s(:iso8601) # => "2007-11-10"
32
+ # date.to_fs(:short) # => "10 Nov"
33
+ # date.to_fs(:number) # => "20071110"
34
+ # date.to_fs(:long) # => "November 10, 2007"
35
+ # date.to_fs(:long_ordinal) # => "November 10th, 2007"
36
+ # date.to_fs(:rfc822) # => "10 Nov 2007"
37
+ # date.to_fs(:iso8601) # => "2007-11-10"
38
38
  #
39
- # == Adding your own date formats to to_formatted_s
39
+ # == Adding your own date formats to to_fs
40
40
  # You can add your own formats to the Date::DATE_FORMATS hash.
41
41
  # Use the format name as the hash key and either a strftime string
42
42
  # or Proc instance that takes a date argument as the value.
@@ -44,7 +44,7 @@ class Date
44
44
  # # config/initializers/date_formats.rb
45
45
  # Date::DATE_FORMATS[:month_and_year] = '%B %Y'
46
46
  # Date::DATE_FORMATS[:short_ordinal] = ->(date) { date.strftime("%B #{date.day.ordinalize}") }
47
- def to_formatted_s(format = :default)
47
+ def to_fs(format = :default)
48
48
  if formatter = DATE_FORMATS[format]
49
49
  if formatter.respond_to?(:call)
50
50
  formatter.call(self).to_s
@@ -55,7 +55,7 @@ class Date
55
55
  to_default_s
56
56
  end
57
57
  end
58
- alias_method :to_fs, :to_formatted_s
58
+ alias_method :to_formatted_s, :to_fs
59
59
  alias_method :to_default_s, :to_s
60
60
 
61
61
  # Overrides the default inspect method with a human readable one, e.g., "Mon, 21 Feb 2005"
@@ -7,7 +7,7 @@ class Date
7
7
  def to_s(format = NOT_SET) # :nodoc:
8
8
  if formatter = DATE_FORMATS[format]
9
9
  ActiveSupport::Deprecation.warn(
10
- "Date#to_s(#{format.inspect}) is deprecated. Please use Date#to_formatted_s(#{format.inspect}) instead."
10
+ "Date#to_s(#{format.inspect}) is deprecated. Please use Date#to_fs(#{format.inspect}) instead."
11
11
  )
12
12
  if formatter.respond_to?(:call)
13
13
  formatter.call(self).to_s
@@ -18,7 +18,7 @@ class Date
18
18
  to_default_s
19
19
  else
20
20
  ActiveSupport::Deprecation.warn(
21
- "Date#to_s(#{format.inspect}) is deprecated. Please use Date#to_formatted_s(#{format.inspect}) instead."
21
+ "Date#to_s(#{format.inspect}) is deprecated. Please use Date#to_fs(#{format.inspect}) instead."
22
22
  )
23
23
  to_default_s
24
24
  end
@@ -9,21 +9,21 @@ require "active_support/values/time_zone"
9
9
  class DateTime
10
10
  # Convert to a formatted string. See Time::DATE_FORMATS for predefined formats.
11
11
  #
12
- # This method is aliased to <tt>to_fs</tt>.
12
+ # This method is aliased to <tt>to_formatted_s</tt>.
13
13
  #
14
14
  # === Examples
15
15
  # datetime = DateTime.civil(2007, 12, 4, 0, 0, 0, 0) # => Tue, 04 Dec 2007 00:00:00 +0000
16
16
  #
17
- # datetime.to_formatted_s(:db) # => "2007-12-04 00:00:00"
18
- # datetime.to_fs(:db) # => "2007-12-04 00:00:00"
19
- # datetime.to_formatted_s(:number) # => "20071204000000"
20
- # datetime.to_formatted_s(:short) # => "04 Dec 00:00"
21
- # datetime.to_formatted_s(:long) # => "December 04, 2007 00:00"
22
- # datetime.to_formatted_s(:long_ordinal) # => "December 4th, 2007 00:00"
23
- # datetime.to_formatted_s(:rfc822) # => "Tue, 04 Dec 2007 00:00:00 +0000"
24
- # datetime.to_formatted_s(:iso8601) # => "2007-12-04T00:00:00+00:00"
17
+ # datetime.to_fs(:db) # => "2007-12-04 00:00:00"
18
+ # datetime.to_formatted_s(:db) # => "2007-12-04 00:00:00"
19
+ # datetime.to_fs(:number) # => "20071204000000"
20
+ # datetime.to_fs(:short) # => "04 Dec 00:00"
21
+ # datetime.to_fs(:long) # => "December 04, 2007 00:00"
22
+ # datetime.to_fs(:long_ordinal) # => "December 4th, 2007 00:00"
23
+ # datetime.to_fs(:rfc822) # => "Tue, 04 Dec 2007 00:00:00 +0000"
24
+ # datetime.to_fs(:iso8601) # => "2007-12-04T00:00:00+00:00"
25
25
  #
26
- # == Adding your own datetime formats to to_formatted_s
26
+ # == Adding your own datetime formats to to_fs
27
27
  # DateTime formats are shared with Time. You can add your own to the
28
28
  # Time::DATE_FORMATS hash. Use the format name as the hash key and
29
29
  # either a strftime string or Proc instance that takes a time or
@@ -32,14 +32,14 @@ class DateTime
32
32
  # # config/initializers/time_formats.rb
33
33
  # Time::DATE_FORMATS[:month_and_year] = '%B %Y'
34
34
  # Time::DATE_FORMATS[:short_ordinal] = lambda { |time| time.strftime("%B #{time.day.ordinalize}") }
35
- def to_formatted_s(format = :default)
35
+ def to_fs(format = :default)
36
36
  if formatter = ::Time::DATE_FORMATS[format]
37
37
  formatter.respond_to?(:call) ? formatter.call(self).to_s : strftime(formatter)
38
38
  else
39
39
  to_default_s
40
40
  end
41
41
  end
42
- alias_method :to_fs, :to_formatted_s
42
+ alias_method :to_formatted_s, :to_fs
43
43
  alias_method :to_default_s, :to_s if instance_methods(false).include?(:to_s)
44
44
 
45
45
  # Returns a formatted string of the offset from UTC, or an alternative
@@ -54,7 +54,7 @@ class DateTime
54
54
 
55
55
  # Overrides the default inspect method with a human readable one, e.g., "Mon, 21 Feb 2005 14:30:00 +0000".
56
56
  def readable_inspect
57
- to_formatted_s(:rfc822)
57
+ to_fs(:rfc822)
58
58
  end
59
59
  alias_method :default_inspect, :inspect
60
60
  alias_method :inspect, :readable_inspect
@@ -7,14 +7,14 @@ class DateTime
7
7
  def to_s(format = NOT_SET) # :nodoc:
8
8
  if formatter = ::Time::DATE_FORMATS[format]
9
9
  ActiveSupport::Deprecation.warn(
10
- "DateTime#to_s(#{format.inspect}) is deprecated. Please use DateTime#to_formatted_s(#{format.inspect}) instead."
10
+ "DateTime#to_s(#{format.inspect}) is deprecated. Please use DateTime#to_fs(#{format.inspect}) instead."
11
11
  )
12
12
  formatter.respond_to?(:call) ? formatter.call(self).to_s : strftime(formatter)
13
13
  elsif format == NOT_SET
14
14
  to_default_s
15
15
  else
16
16
  ActiveSupport::Deprecation.warn(
17
- "DateTime#to_s(#{format.inspect}) is deprecated. Please use DateTime#to_formatted_s(#{format.inspect}) instead."
17
+ "DateTime#to_s(#{format.inspect}) is deprecated. Please use DateTime#to_fs(#{format.inspect}) instead."
18
18
  )
19
19
  to_default_s
20
20
  end
@@ -22,16 +22,16 @@ module Enumerable
22
22
 
23
23
  # Calculates the minimum from the extracted elements.
24
24
  #
25
- # payments = [Payment.new(5), Payment.new(15), Payment.new(10)]
26
- # payments.minimum(:price) # => 5
25
+ # payments = [Payment.new(5), Payment.new(15), Payment.new(10)]
26
+ # payments.minimum(:price) # => 5
27
27
  def minimum(key)
28
28
  map(&key).min
29
29
  end
30
30
 
31
31
  # Calculates the maximum from the extracted elements.
32
32
  #
33
- # payments = [Payment.new(5), Payment.new(15), Payment.new(10)]
34
- # payments.maximum(:price) # => 15
33
+ # payments = [Payment.new(5), Payment.new(15), Payment.new(10)]
34
+ # payments.maximum(:price) # => 15
35
35
  def maximum(key)
36
36
  map(&key).max
37
37
  end
@@ -47,13 +47,13 @@ module Enumerable
47
47
  #
48
48
  # It can also calculate the sum without the use of a block.
49
49
  #
50
- # [5, 15, 10].sum # => 30
51
- # ['foo', 'bar'].sum('') # => "foobar"
52
- # [[1, 2], [3, 1, 5]].sum([]) # => [1, 2, 3, 1, 5]
50
+ # [5, 15, 10].sum # => 30
51
+ # ['foo', 'bar'].sum('') # => "foobar"
52
+ # [[1, 2], [3, 1, 5]].sum([]) # => [1, 2, 3, 1, 5]
53
53
  #
54
54
  # The default sum of an empty list is zero. You can override this default:
55
55
  #
56
- # [].sum(Payment.new(0)) { |i| i.amount } # => Payment.new(0)
56
+ # [].sum(Payment.new(0)) { |i| i.amount } # => Payment.new(0)
57
57
  def sum(identity = nil, &block)
58
58
  if identity
59
59
  _original_sum_with_required_identity(identity, &block)
@@ -205,16 +205,16 @@ module Enumerable
205
205
  # Returns a new +Array+ without the blank items.
206
206
  # Uses Object#blank? for determining if an item is blank.
207
207
  #
208
- # [1, "", nil, 2, " ", [], {}, false, true].compact_blank
209
- # # => [1, 2, true]
208
+ # [1, "", nil, 2, " ", [], {}, false, true].compact_blank
209
+ # # => [1, 2, true]
210
210
  #
211
- # Set.new([nil, "", 1, 2])
212
- # # => [2, 1] (or [1, 2])
211
+ # Set.new([nil, "", 1, 2])
212
+ # # => [2, 1] (or [1, 2])
213
213
  #
214
214
  # When called on a +Hash+, returns a new +Hash+ without the blank values.
215
215
  #
216
- # { a: "", b: 1, c: nil, d: [], e: false, f: true }.compact_blank
217
- # #=> { b: 1, f: true }
216
+ # { a: "", b: 1, c: nil, d: [], e: false, f: true }.compact_blank
217
+ # # => { b: 1, f: true }
218
218
  def compact_blank
219
219
  reject(&:blank?)
220
220
  end
@@ -223,7 +223,7 @@ module Enumerable
223
223
  # objects in the original enumerable.
224
224
  #
225
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) ]
226
+ # # => [ Person.find(1), Person.find(5), Person.find(3) ]
227
227
  #
228
228
  # If the +series+ include keys that have no corresponding element in the Enumerable, these are ignored.
229
229
  # If the Enumerable has additional elements that aren't named in the +series+, these are not included in the result.
@@ -234,9 +234,9 @@ module Enumerable
234
234
  # Returns the sole item in the enumerable. If there are no items, or more
235
235
  # than one item, raises +Enumerable::SoleItemExpectedError+.
236
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
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
240
  def sole
241
241
  case count
242
242
  when 1 then return first # rubocop:disable Style/RedundantReturn
@@ -255,9 +255,9 @@ class Hash
255
255
  # Removes all blank values from the +Hash+ in place and returns self.
256
256
  # Uses Object#blank? for determining if a value is blank.
257
257
  #
258
- # h = { a: "", b: 1, c: nil, d: [], e: false, f: true }
259
- # h.compact_blank!
260
- # # => { b: 1, f: true }
258
+ # h = { a: "", b: 1, c: nil, d: [], e: false, f: true }
259
+ # h.compact_blank!
260
+ # # => { b: 1, f: true }
261
261
  def compact_blank!
262
262
  # use delete_if rather than reject! because it always returns self even if nothing changed
263
263
  delete_if { |_k, v| v.blank? }
@@ -302,9 +302,9 @@ class Array # :nodoc:
302
302
  # Removes all blank elements from the +Array+ in place and returns self.
303
303
  # Uses Object#blank? for determining if an item is blank.
304
304
  #
305
- # a = [1, "", nil, 2, " ", [], {}, false, true]
306
- # a.compact_blank!
307
- # # => [1, 2, true]
305
+ # a = [1, "", nil, 2, " ", [], {}, false, true]
306
+ # a.compact_blank!
307
+ # # => [1, 2, true]
308
308
  def compact_blank!
309
309
  # use delete_if rather than reject! because it always returns self even if nothing changed
310
310
  delete_if(&:blank?)
@@ -64,6 +64,8 @@ class File
64
64
  file_name = join(dir, basename)
65
65
  FileUtils.touch(file_name)
66
66
  stat(file_name)
67
+ rescue Errno::ENOENT
68
+ file_name = nil
67
69
  ensure
68
70
  FileUtils.rm_f(file_name) if file_name
69
71
  end
@@ -9,7 +9,7 @@ module ActiveSupport
9
9
  # Options are provided for phone numbers, currency, percentage,
10
10
  # precision, positional notation, file size and pretty printing.
11
11
  #
12
- # This method is aliased to <tt>to_fs</tt>.
12
+ # This method is aliased to <tt>to_formatted_s</tt>.
13
13
  #
14
14
  # ==== Options
15
15
  #
@@ -18,97 +18,97 @@ module ActiveSupport
18
18
  # ==== Examples
19
19
  #
20
20
  # Phone Numbers:
21
- # 5551234.to_formatted_s(:phone) # => "555-1234"
22
- # 1235551234.to_formatted_s(:phone) # => "123-555-1234"
23
- # 1235551234.to_formatted_s(:phone, area_code: true) # => "(123) 555-1234"
24
- # 1235551234.to_formatted_s(:phone, delimiter: ' ') # => "123 555 1234"
25
- # 1235551234.to_formatted_s(:phone, area_code: true, extension: 555) # => "(123) 555-1234 x 555"
26
- # 1235551234.to_formatted_s(:phone, country_code: 1) # => "+1-123-555-1234"
27
- # 1235551234.to_formatted_s(:phone, country_code: 1, extension: 1343, delimiter: '.')
21
+ # 5551234.to_fs(:phone) # => "555-1234"
22
+ # 1235551234.to_fs(:phone) # => "123-555-1234"
23
+ # 1235551234.to_fs(:phone, area_code: true) # => "(123) 555-1234"
24
+ # 1235551234.to_fs(:phone, delimiter: ' ') # => "123 555 1234"
25
+ # 1235551234.to_fs(:phone, area_code: true, extension: 555) # => "(123) 555-1234 x 555"
26
+ # 1235551234.to_fs(:phone, country_code: 1) # => "+1-123-555-1234"
27
+ # 1235551234.to_fs(:phone, country_code: 1, extension: 1343, delimiter: '.')
28
28
  # # => "+1.123.555.1234 x 1343"
29
29
  #
30
30
  # Currency:
31
- # 1234567890.50.to_formatted_s(:currency) # => "$1,234,567,890.50"
32
- # 1234567890.506.to_formatted_s(:currency) # => "$1,234,567,890.51"
33
- # 1234567890.506.to_formatted_s(:currency, precision: 3) # => "$1,234,567,890.506"
34
- # 1234567890.506.to_formatted_s(:currency, round_mode: :down) # => "$1,234,567,890.50"
35
- # 1234567890.506.to_formatted_s(:currency, locale: :fr) # => "1 234 567 890,51 €"
36
- # -1234567890.50.to_formatted_s(:currency, negative_format: '(%u%n)')
31
+ # 1234567890.50.to_fs(:currency) # => "$1,234,567,890.50"
32
+ # 1234567890.506.to_fs(:currency) # => "$1,234,567,890.51"
33
+ # 1234567890.506.to_fs(:currency, precision: 3) # => "$1,234,567,890.506"
34
+ # 1234567890.506.to_fs(:currency, round_mode: :down) # => "$1,234,567,890.50"
35
+ # 1234567890.506.to_fs(:currency, locale: :fr) # => "1 234 567 890,51 €"
36
+ # -1234567890.50.to_fs(:currency, negative_format: '(%u%n)')
37
37
  # # => "($1,234,567,890.50)"
38
- # 1234567890.50.to_formatted_s(:currency, unit: '&pound;', separator: ',', delimiter: '')
38
+ # 1234567890.50.to_fs(:currency, unit: '&pound;', separator: ',', delimiter: '')
39
39
  # # => "&pound;1234567890,50"
40
- # 1234567890.50.to_formatted_s(:currency, unit: '&pound;', separator: ',', delimiter: '', format: '%n %u')
40
+ # 1234567890.50.to_fs(:currency, unit: '&pound;', separator: ',', delimiter: '', format: '%n %u')
41
41
  # # => "1234567890,50 &pound;"
42
42
  #
43
43
  # Percentage:
44
- # 100.to_formatted_s(:percentage) # => "100.000%"
45
- # 100.to_formatted_s(:percentage, precision: 0) # => "100%"
46
- # 1000.to_formatted_s(:percentage, delimiter: '.', separator: ',') # => "1.000,000%"
47
- # 302.24398923423.to_formatted_s(:percentage, precision: 5) # => "302.24399%"
48
- # 302.24398923423.to_formatted_s(:percentage, round_mode: :down) # => "302.243%"
49
- # 1000.to_formatted_s(:percentage, locale: :fr) # => "1 000,000%"
50
- # 100.to_formatted_s(:percentage, format: '%n %') # => "100.000 %"
44
+ # 100.to_fs(:percentage) # => "100.000%"
45
+ # 100.to_fs(:percentage, precision: 0) # => "100%"
46
+ # 1000.to_fs(:percentage, delimiter: '.', separator: ',') # => "1.000,000%"
47
+ # 302.24398923423.to_fs(:percentage, precision: 5) # => "302.24399%"
48
+ # 302.24398923423.to_fs(:percentage, round_mode: :down) # => "302.243%"
49
+ # 1000.to_fs(:percentage, locale: :fr) # => "1 000,000%"
50
+ # 100.to_fs(:percentage, format: '%n %') # => "100.000 %"
51
51
  #
52
52
  # Delimited:
53
- # 12345678.to_formatted_s(:delimited) # => "12,345,678"
54
- # 12345678.05.to_formatted_s(:delimited) # => "12,345,678.05"
55
- # 12345678.to_formatted_s(:delimited, delimiter: '.') # => "12.345.678"
56
- # 12345678.to_formatted_s(:delimited, delimiter: ',') # => "12,345,678"
57
- # 12345678.05.to_formatted_s(:delimited, separator: ' ') # => "12,345,678 05"
58
- # 12345678.05.to_formatted_s(:delimited, locale: :fr) # => "12 345 678,05"
59
- # 98765432.98.to_formatted_s(:delimited, delimiter: ' ', separator: ',')
53
+ # 12345678.to_fs(:delimited) # => "12,345,678"
54
+ # 12345678.05.to_fs(:delimited) # => "12,345,678.05"
55
+ # 12345678.to_fs(:delimited, delimiter: '.') # => "12.345.678"
56
+ # 12345678.to_fs(:delimited, delimiter: ',') # => "12,345,678"
57
+ # 12345678.05.to_fs(:delimited, separator: ' ') # => "12,345,678 05"
58
+ # 12345678.05.to_fs(:delimited, locale: :fr) # => "12 345 678,05"
59
+ # 98765432.98.to_fs(:delimited, delimiter: ' ', separator: ',')
60
60
  # # => "98 765 432,98"
61
61
  #
62
62
  # Rounded:
63
- # 111.2345.to_formatted_s(:rounded) # => "111.235"
64
- # 111.2345.to_formatted_s(:rounded, precision: 2) # => "111.23"
65
- # 111.2345.to_formatted_s(:rounded, precision: 2, round_mode: :up) # => "111.24"
66
- # 13.to_formatted_s(:rounded, precision: 5) # => "13.00000"
67
- # 389.32314.to_formatted_s(:rounded, precision: 0) # => "389"
68
- # 111.2345.to_formatted_s(:rounded, significant: true) # => "111"
69
- # 111.2345.to_formatted_s(:rounded, precision: 1, significant: true) # => "100"
70
- # 13.to_formatted_s(:rounded, precision: 5, significant: true) # => "13.000"
71
- # 111.234.to_formatted_s(:rounded, locale: :fr) # => "111,234"
72
- # 13.to_formatted_s(:rounded, precision: 5, significant: true, strip_insignificant_zeros: true)
63
+ # 111.2345.to_fs(:rounded) # => "111.235"
64
+ # 111.2345.to_fs(:rounded, precision: 2) # => "111.23"
65
+ # 111.2345.to_fs(:rounded, precision: 2, round_mode: :up) # => "111.24"
66
+ # 13.to_fs(:rounded, precision: 5) # => "13.00000"
67
+ # 389.32314.to_fs(:rounded, precision: 0) # => "389"
68
+ # 111.2345.to_fs(:rounded, significant: true) # => "111"
69
+ # 111.2345.to_fs(:rounded, precision: 1, significant: true) # => "100"
70
+ # 13.to_fs(:rounded, precision: 5, significant: true) # => "13.000"
71
+ # 111.234.to_fs(:rounded, locale: :fr) # => "111,234"
72
+ # 13.to_fs(:rounded, precision: 5, significant: true, strip_insignificant_zeros: true)
73
73
  # # => "13"
74
- # 389.32314.to_formatted_s(:rounded, precision: 4, significant: true) # => "389.3"
75
- # 1111.2345.to_formatted_s(:rounded, precision: 2, separator: ',', delimiter: '.')
74
+ # 389.32314.to_fs(:rounded, precision: 4, significant: true) # => "389.3"
75
+ # 1111.2345.to_fs(:rounded, precision: 2, separator: ',', delimiter: '.')
76
76
  # # => "1.111,23"
77
77
  #
78
78
  # Human-friendly size in Bytes:
79
- # 123.to_formatted_s(:human_size) # => "123 Bytes"
80
- # 1234.to_formatted_s(:human_size) # => "1.21 KB"
81
- # 12345.to_formatted_s(:human_size) # => "12.1 KB"
82
- # 1234567.to_formatted_s(:human_size) # => "1.18 MB"
83
- # 1234567890.to_formatted_s(:human_size) # => "1.15 GB"
84
- # 1234567890123.to_formatted_s(:human_size) # => "1.12 TB"
85
- # 1234567890123456.to_formatted_s(:human_size) # => "1.1 PB"
86
- # 1234567890123456789.to_formatted_s(:human_size) # => "1.07 EB"
87
- # 1234567.to_formatted_s(:human_size, precision: 2) # => "1.2 MB"
88
- # 1234567.to_formatted_s(:human_size, precision: 2, round_mode: :up) # => "1.3 MB"
89
- # 483989.to_formatted_s(:human_size, precision: 2) # => "470 KB"
90
- # 1234567.to_formatted_s(:human_size, precision: 2, separator: ',') # => "1,2 MB"
91
- # 1234567890123.to_formatted_s(:human_size, precision: 5) # => "1.1228 TB"
92
- # 524288000.to_formatted_s(:human_size, precision: 5) # => "500 MB"
79
+ # 123.to_fs(:human_size) # => "123 Bytes"
80
+ # 1234.to_fs(:human_size) # => "1.21 KB"
81
+ # 12345.to_fs(:human_size) # => "12.1 KB"
82
+ # 1234567.to_fs(:human_size) # => "1.18 MB"
83
+ # 1234567890.to_fs(:human_size) # => "1.15 GB"
84
+ # 1234567890123.to_fs(:human_size) # => "1.12 TB"
85
+ # 1234567890123456.to_fs(:human_size) # => "1.1 PB"
86
+ # 1234567890123456789.to_fs(:human_size) # => "1.07 EB"
87
+ # 1234567.to_fs(:human_size, precision: 2) # => "1.2 MB"
88
+ # 1234567.to_fs(:human_size, precision: 2, round_mode: :up) # => "1.3 MB"
89
+ # 483989.to_fs(:human_size, precision: 2) # => "470 KB"
90
+ # 1234567.to_fs(:human_size, precision: 2, separator: ',') # => "1,2 MB"
91
+ # 1234567890123.to_fs(:human_size, precision: 5) # => "1.1228 TB"
92
+ # 524288000.to_fs(:human_size, precision: 5) # => "500 MB"
93
93
  #
94
94
  # Human-friendly format:
95
- # 123.to_formatted_s(:human) # => "123"
96
- # 1234.to_formatted_s(:human) # => "1.23 Thousand"
97
- # 12345.to_formatted_s(:human) # => "12.3 Thousand"
98
- # 1234567.to_formatted_s(:human) # => "1.23 Million"
99
- # 1234567890.to_formatted_s(:human) # => "1.23 Billion"
100
- # 1234567890123.to_formatted_s(:human) # => "1.23 Trillion"
101
- # 1234567890123456.to_formatted_s(:human) # => "1.23 Quadrillion"
102
- # 1234567890123456789.to_formatted_s(:human) # => "1230 Quadrillion"
103
- # 489939.to_formatted_s(:human, precision: 2) # => "490 Thousand"
104
- # 489939.to_formatted_s(:human, precision: 2, round_mode: :down) # => "480 Thousand"
105
- # 489939.to_formatted_s(:human, precision: 4) # => "489.9 Thousand"
106
- # 1234567.to_formatted_s(:human, precision: 4,
95
+ # 123.to_fs(:human) # => "123"
96
+ # 1234.to_fs(:human) # => "1.23 Thousand"
97
+ # 12345.to_fs(:human) # => "12.3 Thousand"
98
+ # 1234567.to_fs(:human) # => "1.23 Million"
99
+ # 1234567890.to_fs(:human) # => "1.23 Billion"
100
+ # 1234567890123.to_fs(:human) # => "1.23 Trillion"
101
+ # 1234567890123456.to_fs(:human) # => "1.23 Quadrillion"
102
+ # 1234567890123456789.to_fs(:human) # => "1230 Quadrillion"
103
+ # 489939.to_fs(:human, precision: 2) # => "490 Thousand"
104
+ # 489939.to_fs(:human, precision: 2, round_mode: :down) # => "480 Thousand"
105
+ # 489939.to_fs(:human, precision: 4) # => "489.9 Thousand"
106
+ # 1234567.to_fs(:human, precision: 4,
107
107
  # significant: false) # => "1.2346 Million"
108
- # 1234567.to_formatted_s(:human, precision: 1,
108
+ # 1234567.to_fs(:human, precision: 1,
109
109
  # separator: ',',
110
110
  # significant: false) # => "1,2 Million"
111
- def to_formatted_s(format = nil, options = nil)
111
+ def to_fs(format = nil, options = nil)
112
112
  return to_s if format.nil?
113
113
 
114
114
  case format
@@ -134,7 +134,7 @@ module ActiveSupport
134
134
  to_s(format)
135
135
  end
136
136
  end
137
- alias_method :to_fs, :to_formatted_s
137
+ alias_method :to_formatted_s, :to_fs
138
138
  end
139
139
  end
140
140
 
@@ -10,42 +10,42 @@ module ActiveSupport
10
10
  super(format)
11
11
  when :phone
12
12
  ActiveSupport::Deprecation.warn(
13
- "#{self.class}#to_s(#{format.inspect}) is deprecated. Please use #{self.class}#to_formatted_s(#{format.inspect}) instead."
13
+ "#{self.class}#to_s(#{format.inspect}) is deprecated. Please use #{self.class}#to_fs(#{format.inspect}) instead."
14
14
  )
15
15
  ActiveSupport::NumberHelper.number_to_phone(self, options || {})
16
16
  when :currency
17
17
  ActiveSupport::Deprecation.warn(
18
- "#{self.class}#to_s(#{format.inspect}) is deprecated. Please use #{self.class}#to_formatted_s(#{format.inspect}) instead."
18
+ "#{self.class}#to_s(#{format.inspect}) is deprecated. Please use #{self.class}#to_fs(#{format.inspect}) instead."
19
19
  )
20
20
  ActiveSupport::NumberHelper.number_to_currency(self, options || {})
21
21
  when :percentage
22
22
  ActiveSupport::Deprecation.warn(
23
- "#{self.class}#to_s(#{format.inspect}) is deprecated. Please use #{self.class}#to_formatted_s(#{format.inspect}) instead."
23
+ "#{self.class}#to_s(#{format.inspect}) is deprecated. Please use #{self.class}#to_fs(#{format.inspect}) instead."
24
24
  )
25
25
  ActiveSupport::NumberHelper.number_to_percentage(self, options || {})
26
26
  when :delimited
27
27
  ActiveSupport::Deprecation.warn(
28
- "#{self.class}#to_s(#{format.inspect}) is deprecated. Please use #{self.class}#to_formatted_s(#{format.inspect}) instead."
28
+ "#{self.class}#to_s(#{format.inspect}) is deprecated. Please use #{self.class}#to_fs(#{format.inspect}) instead."
29
29
  )
30
30
  ActiveSupport::NumberHelper.number_to_delimited(self, options || {})
31
31
  when :rounded
32
32
  ActiveSupport::Deprecation.warn(
33
- "#{self.class}#to_s(#{format.inspect}) is deprecated. Please use #{self.class}#to_formatted_s(#{format.inspect}) instead."
33
+ "#{self.class}#to_s(#{format.inspect}) is deprecated. Please use #{self.class}#to_fs(#{format.inspect}) instead."
34
34
  )
35
35
  ActiveSupport::NumberHelper.number_to_rounded(self, options || {})
36
36
  when :human
37
37
  ActiveSupport::Deprecation.warn(
38
- "#{self.class}#to_s(#{format.inspect}) is deprecated. Please use #{self.class}#to_formatted_s(#{format.inspect}) instead."
38
+ "#{self.class}#to_s(#{format.inspect}) is deprecated. Please use #{self.class}#to_fs(#{format.inspect}) instead."
39
39
  )
40
40
  ActiveSupport::NumberHelper.number_to_human(self, options || {})
41
41
  when :human_size
42
42
  ActiveSupport::Deprecation.warn(
43
- "#{self.class}#to_s(#{format.inspect}) is deprecated. Please use #{self.class}#to_formatted_s(#{format.inspect}) instead."
43
+ "#{self.class}#to_s(#{format.inspect}) is deprecated. Please use #{self.class}#to_fs(#{format.inspect}) instead."
44
44
  )
45
45
  ActiveSupport::NumberHelper.number_to_human_size(self, options || {})
46
46
  when Symbol
47
47
  ActiveSupport::Deprecation.warn(
48
- "#{self.class}#to_s(#{format.inspect}) is deprecated. Please use #{self.class}#to_formatted_s(#{format.inspect}) instead."
48
+ "#{self.class}#to_s(#{format.inspect}) is deprecated. Please use #{self.class}#to_fs(#{format.inspect}) instead."
49
49
  )
50
50
  super()
51
51
  else
@@ -7,34 +7,34 @@ module ActiveSupport
7
7
  case start
8
8
  when String then "BETWEEN '#{start}' AND '#{stop}'"
9
9
  else
10
- "BETWEEN '#{start.to_formatted_s(:db)}' AND '#{stop.to_formatted_s(:db)}'"
10
+ "BETWEEN '#{start.to_fs(:db)}' AND '#{stop.to_fs(:db)}'"
11
11
  end
12
12
  end
13
13
  }
14
14
 
15
15
  # Convert range to a formatted string. See RANGE_FORMATS for predefined formats.
16
16
  #
17
- # This method is aliased to <tt>to_fs</tt>.
17
+ # This method is aliased to <tt>to_formatted_s</tt>.
18
18
  #
19
19
  # range = (1..100) # => 1..100
20
20
  #
21
21
  # range.to_s # => "1..100"
22
- # range.to_formatted_s(:db) # => "BETWEEN '1' AND '100'"
22
+ # range.to_fs(:db) # => "BETWEEN '1' AND '100'"
23
23
  #
24
24
  # == Adding your own range formats to to_s
25
25
  # You can add your own formats to the Range::RANGE_FORMATS hash.
26
26
  # Use the format name as the hash key and a Proc instance.
27
27
  #
28
28
  # # config/initializers/range_formats.rb
29
- # Range::RANGE_FORMATS[:short] = ->(start, stop) { "Between #{start.to_formatted_s(:db)} and #{stop.to_formatted_s(:db)}" }
30
- def to_formatted_s(format = :default)
29
+ # Range::RANGE_FORMATS[:short] = ->(start, stop) { "Between #{start.to_fs(:db)} and #{stop.to_fs(:db)}" }
30
+ def to_fs(format = :default)
31
31
  if formatter = RANGE_FORMATS[format]
32
32
  formatter.call(first, last)
33
33
  else
34
34
  to_s
35
35
  end
36
36
  end
37
- alias_method :to_fs, :to_formatted_s
37
+ alias_method :to_formatted_s, :to_fs
38
38
  end
39
39
  end
40
40
 
@@ -6,14 +6,14 @@ module ActiveSupport
6
6
  def to_s(format = NOT_SET)
7
7
  if formatter = RangeWithFormat::RANGE_FORMATS[format]
8
8
  ActiveSupport::Deprecation.warn(
9
- "Range#to_s(#{format.inspect}) is deprecated. Please use Range#to_formatted_s(#{format.inspect}) instead."
9
+ "Range#to_s(#{format.inspect}) is deprecated. Please use Range#to_fs(#{format.inspect}) instead."
10
10
  )
11
11
  formatter.call(first, last)
12
12
  elsif format == NOT_SET
13
13
  super()
14
14
  else
15
15
  ActiveSupport::Deprecation.warn(
16
- "Range#to_s(#{format.inspect}) is deprecated. Please use Range#to_formatted_s(#{format.inspect}) instead."
16
+ "Range#to_s(#{format.inspect}) is deprecated. Please use Range#to_fs(#{format.inspect}) instead."
17
17
  )
18
18
  super()
19
19
  end
@@ -27,22 +27,22 @@ class Time
27
27
 
28
28
  # Converts to a formatted string. See DATE_FORMATS for built-in formats.
29
29
  #
30
- # This method is aliased to <tt>to_fs</tt>.
30
+ # This method is aliased to <tt>to_formatted_s</tt>.
31
31
  #
32
32
  # time = Time.now # => 2007-01-18 06:10:17 -06:00
33
33
  #
34
- # time.to_formatted_s(:time) # => "06:10"
35
34
  # time.to_fs(:time) # => "06:10"
35
+ # time.to_formatted_s(:time) # => "06:10"
36
36
  #
37
- # time.to_formatted_s(:db) # => "2007-01-18 06:10:17"
38
- # time.to_formatted_s(:number) # => "20070118061017"
39
- # time.to_formatted_s(:short) # => "18 Jan 06:10"
40
- # time.to_formatted_s(:long) # => "January 18, 2007 06:10"
41
- # time.to_formatted_s(:long_ordinal) # => "January 18th, 2007 06:10"
42
- # time.to_formatted_s(:rfc822) # => "Thu, 18 Jan 2007 06:10:17 -0600"
43
- # time.to_formatted_s(:iso8601) # => "2007-01-18T06:10:17-06:00"
37
+ # time.to_fs(:db) # => "2007-01-18 06:10:17"
38
+ # time.to_fs(:number) # => "20070118061017"
39
+ # time.to_fs(:short) # => "18 Jan 06:10"
40
+ # time.to_fs(:long) # => "January 18, 2007 06:10"
41
+ # time.to_fs(:long_ordinal) # => "January 18th, 2007 06:10"
42
+ # time.to_fs(:rfc822) # => "Thu, 18 Jan 2007 06:10:17 -0600"
43
+ # time.to_fs(:iso8601) # => "2007-01-18T06:10:17-06:00"
44
44
  #
45
- # == Adding your own time formats to +to_formatted_s+
45
+ # == Adding your own time formats to +to_fs+
46
46
  # You can add your own formats to the Time::DATE_FORMATS hash.
47
47
  # Use the format name as the hash key and either a strftime string
48
48
  # or Proc instance that takes a time argument as the value.
@@ -50,7 +50,7 @@ class Time
50
50
  # # config/initializers/time_formats.rb
51
51
  # Time::DATE_FORMATS[:month_and_year] = '%B %Y'
52
52
  # Time::DATE_FORMATS[:short_ordinal] = ->(time) { time.strftime("%B #{time.day.ordinalize}") }
53
- def to_formatted_s(format = :default)
53
+ def to_fs(format = :default)
54
54
  if formatter = DATE_FORMATS[format]
55
55
  formatter.respond_to?(:call) ? formatter.call(self).to_s : strftime(formatter)
56
56
  else
@@ -58,7 +58,7 @@ class Time
58
58
  to_default_s
59
59
  end
60
60
  end
61
- alias_method :to_fs, :to_formatted_s
61
+ alias_method :to_formatted_s, :to_fs
62
62
  alias_method :to_default_s, :to_s
63
63
 
64
64
  # Returns a formatted string of the offset from UTC, or an alternative
@@ -7,14 +7,14 @@ class Time
7
7
  def to_s(format = NOT_SET) # :nodoc:
8
8
  if formatter = DATE_FORMATS[format]
9
9
  ActiveSupport::Deprecation.warn(
10
- "Time#to_s(#{format.inspect}) is deprecated. Please use Time#to_formatted_s(#{format.inspect}) instead."
10
+ "Time#to_s(#{format.inspect}) is deprecated. Please use Time#to_fs(#{format.inspect}) instead."
11
11
  )
12
12
  formatter.respond_to?(:call) ? formatter.call(self).to_s : strftime(formatter)
13
13
  elsif format == NOT_SET
14
14
  to_default_s
15
15
  else
16
16
  ActiveSupport::Deprecation.warn(
17
- "Time#to_s(#{format.inspect}) is deprecated. Please use Time#to_formatted_s(#{format.inspect}) instead."
17
+ "Time#to_s(#{format.inspect}) is deprecated. Please use Time#to_fs(#{format.inspect}) instead."
18
18
  )
19
19
  to_default_s
20
20
  end
@@ -49,7 +49,8 @@ module ActiveSupport
49
49
  end
50
50
 
51
51
  def deserialize(config)
52
- YAML.load(config).presence || {}
52
+ doc = YAML.respond_to?(:unsafe_load) ? YAML.unsafe_load(config) : YAML.load(config)
53
+ doc.presence || {}
53
54
  end
54
55
  end
55
56
  end
@@ -9,7 +9,7 @@ module ActiveSupport
9
9
  module VERSION
10
10
  MAJOR = 7
11
11
  MINOR = 0
12
- TINY = 1
12
+ TINY = 2
13
13
  PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
@@ -33,7 +33,7 @@ module ActiveSupport
33
33
  # t.dst? # => true
34
34
  # t.utc_offset # => -14400
35
35
  # t.zone # => "EDT"
36
- # t.to_formatted_s(:rfc822) # => "Sun, 18 May 2008 13:27:25 -0400"
36
+ # t.to_fs(:rfc822) # => "Sun, 18 May 2008 13:27:25 -0400"
37
37
  # t + 1.day # => Mon, 19 May 2008 13:27:25.031505668 EDT -04:00
38
38
  # t.beginning_of_year # => Tue, 01 Jan 2008 00:00:00.000000000 EST -05:00
39
39
  # t > Time.utc(1999) # => true
@@ -202,7 +202,7 @@ module ActiveSupport
202
202
  #
203
203
  # Time.zone.now.rfc2822 # => "Tue, 01 Jan 2013 04:51:39 +0000"
204
204
  def rfc2822
205
- to_formatted_s(:rfc822)
205
+ to_fs(:rfc822)
206
206
  end
207
207
  alias_method :rfc822, :rfc2822
208
208
 
@@ -212,19 +212,19 @@ module ActiveSupport
212
212
  def to_s(format = NOT_SET)
213
213
  if format == :db
214
214
  ActiveSupport::Deprecation.warn(
215
- "TimeWithZone#to_s(:db) is deprecated. Please use TimeWithZone#to_formatted_s(:db) instead."
215
+ "TimeWithZone#to_s(:db) is deprecated. Please use TimeWithZone#to_fs(:db) instead."
216
216
  )
217
- utc.to_formatted_s(format)
217
+ utc.to_fs(format)
218
218
  elsif formatter = ::Time::DATE_FORMATS[format]
219
219
  ActiveSupport::Deprecation.warn(
220
- "TimeWithZone#to_s(#{format.inspect}) is deprecated. Please use TimeWithZone#to_formatted_s(#{format.inspect}) instead."
220
+ "TimeWithZone#to_s(#{format.inspect}) is deprecated. Please use TimeWithZone#to_fs(#{format.inspect}) instead."
221
221
  )
222
222
  formatter.respond_to?(:call) ? formatter.call(self).to_s : strftime(formatter)
223
223
  elsif format == NOT_SET
224
224
  "#{time.strftime("%Y-%m-%d %H:%M:%S")} #{formatted_offset(false, 'UTC')}" # mimicking Ruby Time#to_s format
225
225
  else
226
226
  ActiveSupport::Deprecation.warn(
227
- "TimeWithZone#to_s(#{format.inspect}) is deprecated. Please use TimeWithZone#to_formatted_s(#{format.inspect}) instead."
227
+ "TimeWithZone#to_s(#{format.inspect}) is deprecated. Please use TimeWithZone#to_fs(#{format.inspect}) instead."
228
228
  )
229
229
  "#{time.strftime("%Y-%m-%d %H:%M:%S")} #{formatted_offset(false, 'UTC')}" # mimicking Ruby Time#to_s format
230
230
  end
@@ -232,15 +232,15 @@ module ActiveSupport
232
232
 
233
233
  # Returns a string of the object's date and time.
234
234
  #
235
- # This method is aliased to <tt>to_fs</tt>.
235
+ # This method is aliased to <tt>to_formatted_s</tt>.
236
236
  #
237
237
  # Accepts an optional <tt>format</tt>:
238
238
  # * <tt>:default</tt> - default value, mimics Ruby Time#to_s format.
239
- # * <tt>:db</tt> - format outputs time in UTC :db time. See Time#to_formatted_s(:db).
239
+ # * <tt>:db</tt> - format outputs time in UTC :db time. See Time#to_fs(:db).
240
240
  # * Any key in <tt>Time::DATE_FORMATS</tt> can be used. See active_support/core_ext/time/conversions.rb.
241
- def to_formatted_s(format = :default)
241
+ def to_fs(format = :default)
242
242
  if format == :db
243
- utc.to_formatted_s(format)
243
+ utc.to_fs(format)
244
244
  elsif formatter = ::Time::DATE_FORMATS[format]
245
245
  formatter.respond_to?(:call) ? formatter.call(self).to_s : strftime(formatter)
246
246
  else
@@ -248,7 +248,7 @@ module ActiveSupport
248
248
  "#{time.strftime("%Y-%m-%d %H:%M:%S")} #{formatted_offset(false, 'UTC')}"
249
249
  end
250
250
  end
251
- alias_method :to_fs, :to_formatted_s
251
+ alias_method :to_formatted_s, :to_fs
252
252
 
253
253
  # Replaces <tt>%Z</tt> directive with +zone before passing to Time#strftime,
254
254
  # so that zone information is correct.
@@ -54,7 +54,7 @@ module ActiveSupport
54
54
 
55
55
  FORMATTING = {
56
56
  "symbol" => Proc.new { |symbol| symbol.to_s },
57
- "date" => Proc.new { |date| date.to_formatted_s(:db) },
57
+ "date" => Proc.new { |date| date.to_fs(:db) },
58
58
  "dateTime" => Proc.new { |time| time.xmlschema },
59
59
  "binary" => Proc.new { |binary| ::Base64.encode64(binary) },
60
60
  "yaml" => Proc.new { |yaml| yaml.to_yaml }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activesupport
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.1
4
+ version: 7.0.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: 2022-01-06 00:00:00.000000000 Z
11
+ date: 2022-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -359,10 +359,10 @@ licenses:
359
359
  - MIT
360
360
  metadata:
361
361
  bug_tracker_uri: https://github.com/rails/rails/issues
362
- changelog_uri: https://github.com/rails/rails/blob/v7.0.1/activesupport/CHANGELOG.md
363
- documentation_uri: https://api.rubyonrails.org/v7.0.1/
362
+ changelog_uri: https://github.com/rails/rails/blob/v7.0.2/activesupport/CHANGELOG.md
363
+ documentation_uri: https://api.rubyonrails.org/v7.0.2/
364
364
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
365
- source_code_uri: https://github.com/rails/rails/tree/v7.0.1/activesupport
365
+ source_code_uri: https://github.com/rails/rails/tree/v7.0.2/activesupport
366
366
  rubygems_mfa_required: 'true'
367
367
  post_install_message:
368
368
  rdoc_options: