activesupport 6.1.1 → 6.1.4.1

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: 3d215240c46e0de60027e61d480a945128c8c07823224325caa07011fd404054
4
- data.tar.gz: c141c31282b64aa0cb097498b73706811f5de6fb287c90fef4975fb000e6d157
3
+ metadata.gz: 0d2866429ce29fdfb9ae183ca23e131624daf0107d249b6269a393d59db5b1ac
4
+ data.tar.gz: 06d4c6f6b659067bebc386e5d6c62f692466371604b6242493f7abeba38db270
5
5
  SHA512:
6
- metadata.gz: 9f4ac84a1eda835f117fc1c275d87772abf989cd9b51f724f373a8b148f1001135e0687262affaf3cbc4ebf82b4800e089c8c81138f538f92b654c81cd58df8a
7
- data.tar.gz: 7209b244dccaa86cf99de2281316a12a0b308db6f4dd8b65113244fd1e879ee516d81d9ed75ab4ea7936d833e41019c6df95a2389033a5a542276c11602707ea
6
+ metadata.gz: 6ca0f8278c8a7d08151652ee47f69f9a832c3c1cdfc433b97744b404ed41940922a9441718406845e82cbf4852cb60d924d5149f26c8b47694a5895ce93dfb22
7
+ data.tar.gz: a0f724cf8582fb20a2041e3ddda9b129c5cc1c2e9b9cf9aae10cd30edbecaeb43bee9bca780ca3308735895bab765d29d29de39add95e8b66223004f185931bd
data/CHANGELOG.md CHANGED
@@ -1,3 +1,82 @@
1
+ ## Rails 6.1.4.1 (August 19, 2021) ##
2
+
3
+ * No changes.
4
+
5
+
6
+ ## Rails 6.1.4 (June 24, 2021) ##
7
+
8
+ * MemCacheStore: convert any underlying value (including `false`) to an `Entry`.
9
+
10
+ See [#42559](https://github.com/rails/rails/pull/42559).
11
+
12
+ *Alex Ghiculescu*
13
+
14
+ * Fix bug in `number_with_precision` when using large `BigDecimal` values.
15
+
16
+ Fixes #42302.
17
+
18
+ *Federico Aldunate*, *Zachary Scott*
19
+
20
+ * Check byte size instead of length on `secure_compare`.
21
+
22
+ *Tietew*
23
+
24
+ * Fix `Time.at` to not lose `:in` option.
25
+
26
+ *Ryuta Kamizono*
27
+
28
+ * Require a path for `config.cache_store = :file_store`.
29
+
30
+ *Alex Ghiculescu*
31
+
32
+ * Avoid having to store complex object in the default translation file.
33
+
34
+ *Rafael Mendonça França*
35
+
36
+
37
+ ## Rails 6.1.3.2 (May 05, 2021) ##
38
+
39
+ * No changes.
40
+
41
+
42
+ ## Rails 6.1.3.1 (March 26, 2021) ##
43
+
44
+ * No changes.
45
+
46
+
47
+ ## Rails 6.1.3 (February 17, 2021) ##
48
+
49
+ * No changes.
50
+
51
+
52
+ ## Rails 6.1.2.1 (February 10, 2021) ##
53
+
54
+ * No changes.
55
+
56
+
57
+ ## Rails 6.1.2 (February 09, 2021) ##
58
+
59
+ * `ActiveSupport::Cache::MemCacheStore` now accepts an explicit `nil` for its `addresses` argument.
60
+
61
+ ```ruby
62
+ config.cache_store = :mem_cache_store, nil
63
+
64
+ # is now equivalent to
65
+
66
+ config.cache_store = :mem_cache_store
67
+
68
+ # and is also equivalent to
69
+
70
+ config.cache_store = :mem_cache_store, ENV["MEMCACHE_SERVERS"] || "localhost:11211"
71
+
72
+ # which is the fallback behavior of Dalli
73
+ ```
74
+
75
+ This helps those migrating from `:dalli_store`, where an explicit `nil` was permitted.
76
+
77
+ *Michael Overmeyer*
78
+
79
+
1
80
  ## Rails 6.1.1 (January 07, 2021) ##
2
81
 
3
82
  * Change `IPAddr#to_json` to match the behavior of the json gem returning the string representation
data/README.rdoc CHANGED
@@ -15,7 +15,7 @@ The latest version of Active Support can be installed with RubyGems:
15
15
 
16
16
  Source code can be downloaded as part of the Rails project on GitHub:
17
17
 
18
- * https://github.com/rails/rails/tree/master/activesupport
18
+ * https://github.com/rails/rails/tree/main/activesupport
19
19
 
20
20
 
21
21
  == License
@@ -20,7 +20,7 @@ module ActiveSupport
20
20
  FILEPATH_MAX_SIZE = 900 # max is 1024, plus some room
21
21
  GITKEEP_FILES = [".gitkeep", ".keep"].freeze
22
22
 
23
- def initialize(cache_path, options = nil)
23
+ def initialize(cache_path, **options)
24
24
  super(options)
25
25
  @cache_path = cache_path.to_s
26
26
  end
@@ -64,7 +64,7 @@ module ActiveSupport
64
64
  def self.build_mem_cache(*addresses) # :nodoc:
65
65
  addresses = addresses.flatten
66
66
  options = addresses.extract_options!
67
- addresses = nil if addresses.empty?
67
+ addresses = nil if addresses.compact.empty?
68
68
  pool_options = retrieve_pool_options(options)
69
69
 
70
70
  if pool_options.empty?
@@ -185,16 +185,20 @@ module ActiveSupport
185
185
  # before applying the regular expression to ensure we are escaping all
186
186
  # characters properly.
187
187
  def normalize_key(key, options)
188
- key = super.dup
189
- key = key.force_encoding(Encoding::ASCII_8BIT)
190
- key = key.gsub(ESCAPE_KEY_CHARS) { |match| "%#{match.getbyte(0).to_s(16).upcase}" }
191
- key = "#{key[0, 213]}:md5:#{ActiveSupport::Digest.hexdigest(key)}" if key.size > 250
188
+ key = super
189
+
190
+ if key
191
+ key = key.dup.force_encoding(Encoding::ASCII_8BIT)
192
+ key = key.gsub(ESCAPE_KEY_CHARS) { |match| "%#{match.getbyte(0).to_s(16).upcase}" }
193
+ key = "#{key[0, 213]}:md5:#{ActiveSupport::Digest.hexdigest(key)}" if key.size > 250
194
+ end
195
+
192
196
  key
193
197
  end
194
198
 
195
199
  def deserialize_entry(payload)
196
200
  entry = super
197
- entry = Entry.new(entry, compress: false) if entry && !entry.is_a?(Entry)
201
+ entry = Entry.new(entry, compress: false) unless entry.nil? || entry.is_a?(Entry)
198
202
  entry
199
203
  end
200
204
 
@@ -58,7 +58,13 @@ module ActiveSupport
58
58
  case store
59
59
  when Symbol
60
60
  options = parameters.extract_options!
61
- retrieve_store_class(store).new(*parameters, **options)
61
+ # clean this up once Ruby 2.7 support is dropped
62
+ # see https://github.com/rails/rails/pull/41522#discussion_r581186602
63
+ if options.empty?
64
+ retrieve_store_class(store).new(*parameters)
65
+ else
66
+ retrieve_store_class(store).new(*parameters, **options)
67
+ end
62
68
  when Array
63
69
  lookup_store(*store)
64
70
  when nil
@@ -19,7 +19,12 @@ module ActiveSupport
19
19
  end
20
20
 
21
21
  def parse(context: nil, **options)
22
- YAML.load(render(context), **options) || {}
22
+ source = render(context)
23
+ if YAML.respond_to?(:unsafe_load)
24
+ YAML.unsafe_load(source, **options) || {}
25
+ else
26
+ YAML.load(source, **options) || {}
27
+ end
23
28
  rescue Psych::SyntaxError => error
24
29
  raise "YAML syntax error occurred while parsing #{@content_path}. " \
25
30
  "Please note that YAML must be consistently indented using spaces. Tabs are not allowed. " \
@@ -56,6 +56,7 @@ class Time
56
56
  at_without_coercion(time_or_number)
57
57
  end
58
58
  end
59
+ ruby2_keywords(:at_with_coercion) if respond_to?(:ruby2_keywords, true)
59
60
  alias_method :at_without_coercion, :at
60
61
  alias_method :at, :at_with_coercion
61
62
 
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "active_support/callbacks"
4
4
  require "active_support/core_ext/enumerable"
5
+ require "active_support/core_ext/module/delegation"
5
6
 
6
7
  module ActiveSupport
7
8
  # Abstract super class that provides a thread-isolated attributes singleton, which resets automatically
@@ -16,6 +16,7 @@ module ActiveSupport
16
16
  pid
17
17
  end
18
18
  end
19
+ ruby2_keywords(:fork) if respond_to?(:ruby2_keywords, true)
19
20
  end
20
21
 
21
22
  module CoreExtPrivate
@@ -25,6 +26,7 @@ module ActiveSupport
25
26
  def fork(*)
26
27
  super
27
28
  end
29
+ ruby2_keywords(:fork) if respond_to?(:ruby2_keywords, true)
28
30
  end
29
31
 
30
32
  @pid = Process.pid
@@ -9,8 +9,8 @@ module ActiveSupport
9
9
  module VERSION
10
10
  MAJOR = 6
11
11
  MINOR = 1
12
- TINY = 1
13
- PRE = nil
12
+ TINY = 4
13
+ PRE = "1"
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
@@ -3,6 +3,7 @@
3
3
  require "active_support/core_ext/hash/keys"
4
4
  require "active_support/core_ext/hash/reverse_merge"
5
5
  require "active_support/core_ext/hash/except"
6
+ require "active_support/core_ext/hash/slice"
6
7
 
7
8
  module ActiveSupport
8
9
  # Implements a hash where keys <tt>:foo</tt> and <tt>"foo"</tt> are considered
@@ -113,7 +114,7 @@ module ActiveSupport
113
114
  # <tt>ActiveSupport::HashWithIndifferentAccess</tt> or a regular +Hash+.
114
115
  # In either case the merge respects the semantics of indifferent access.
115
116
  #
116
- # If the argument is a regular hash with keys +:key+ and +"key"+ only one
117
+ # If the argument is a regular hash with keys +:key+ and <tt>"key"</tt> only one
117
118
  # of the values end up in the receiver, but which one is unspecified.
118
119
  #
119
120
  # When given a block, the value for duplicated keys will be determined
@@ -293,6 +294,10 @@ module ActiveSupport
293
294
  super(convert_key(key))
294
295
  end
295
296
 
297
+ # Returns a hash with indifferent access that includes everything except given keys.
298
+ # hash = { a: "x", b: "y", c: 10 }.with_indifferent_access
299
+ # hash.except(:a, "b") # => {c: 10}.with_indifferent_access
300
+ # hash # => { a: "x", b: "y", c: 10 }.with_indifferent_access
296
301
  def except(*keys)
297
302
  slice(*self.keys - keys.map { |key| convert_key(key) })
298
303
  end
@@ -45,7 +45,7 @@ en:
45
45
  # Number of decimals, behind the separator (the number 1 with a precision of 2 gives: 1.00)
46
46
  precision: 3
47
47
  # Determine how rounding is performed (see BigDecimal::mode)
48
- round_mode: !ruby/sym default
48
+ round_mode: default
49
49
  # If set to true, precision will mean the number of significant digits instead
50
50
  # of the number of decimal digits (1234 with precision 2 becomes 1200, 1.23543 becomes 1.2)
51
51
  significant: false
@@ -178,7 +178,7 @@ module ActiveSupport
178
178
  #
179
179
  # Subscribers using a regexp or other pattern-matching object will remain subscribed
180
180
  # to all events that match their original pattern, unless those events match a string
181
- # passed to `unsubscribe`:
181
+ # passed to +unsubscribe+:
182
182
  #
183
183
  # subscriber = ActiveSupport::Notifications.subscribe(/render/) { }
184
184
  # ActiveSupport::Notifications.unsubscribe('render_template.action_view')
@@ -20,14 +20,18 @@ module ActiveSupport
20
20
  end
21
21
 
22
22
  formatted_string =
23
- if rounded_number.nan? || rounded_number.infinite? || rounded_number == rounded_number.to_i
24
- "%00.#{precision}f" % rounded_number
25
- else
23
+ if rounded_number.finite?
26
24
  s = rounded_number.to_s("F")
27
- s << "0" * precision
28
25
  a, b = s.split(".", 2)
29
- a << "."
30
- a << b[0, precision]
26
+ if precision != 0
27
+ b << "0" * precision
28
+ a << "."
29
+ a << b[0, precision]
30
+ end
31
+ a
32
+ else
33
+ # Infinity/NaN
34
+ "%f" % rounded_number
31
35
  end
32
36
  else
33
37
  formatted_string = rounded_number
@@ -13,7 +13,7 @@ module ActiveSupport
13
13
  precision = absolute_precision(number)
14
14
  return number unless precision
15
15
 
16
- rounded_number = convert_to_decimal(number).round(precision, options.fetch(:round_mode, :default))
16
+ rounded_number = convert_to_decimal(number).round(precision, options.fetch(:round_mode, :default).to_sym)
17
17
  rounded_number.zero? ? rounded_number.abs : rounded_number # prevent showing negative zeros
18
18
  end
19
19
 
@@ -33,7 +33,7 @@ module ActiveSupport
33
33
  #
34
34
  # ==== Options
35
35
  #
36
- # * <tt>:mask</tt> - A replaced object when filtered. Defaults to +"[FILTERED]"+
36
+ # * <tt>:mask</tt> - A replaced object when filtered. Defaults to <tt>"[FILTERED]"</tt>.
37
37
  def initialize(filters = [], mask: FILTERED)
38
38
  @filters = filters
39
39
  @mask = mask
@@ -31,7 +31,7 @@ module ActiveSupport
31
31
  # the secret length. This should be considered when using secure_compare
32
32
  # to compare weak, short secrets to user input.
33
33
  def secure_compare(a, b)
34
- a.length == b.length && fixed_length_secure_compare(a, b)
34
+ a.bytesize == b.bytesize && fixed_length_secure_compare(a, b)
35
35
  end
36
36
  module_function :secure_compare
37
37
  end
@@ -301,7 +301,7 @@ module ActiveSupport
301
301
  alias_method :in, :+
302
302
 
303
303
  # Subtracts an interval of time and returns a new TimeWithZone object unless
304
- # the other value `acts_like?` time. Then it will return a Float of the difference
304
+ # the other value +acts_like?+ time. Then it will return a Float of the difference
305
305
  # between the two times that represents the difference between the current
306
306
  # object's time and the +other+ time.
307
307
  #
@@ -508,7 +508,7 @@ module ActiveSupport
508
508
  # Time#in_time_zone() instead.
509
509
  #
510
510
  # As of tzinfo 2, utc_to_local returns a Time with a non-zero utc_offset.
511
- # See the `utc_to_local_returns_utc_offset_times` config for more info.
511
+ # See the +utc_to_local_returns_utc_offset_times+ config for more info.
512
512
  def utc_to_local(time)
513
513
  tzinfo.utc_to_local(time).yield_self do |t|
514
514
  ActiveSupport.utc_to_local_returns_utc_offset_times ?
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: 6.1.1
4
+ version: 6.1.4.1
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: 2021-01-07 00:00:00.000000000 Z
11
+ date: 2021-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -357,10 +357,10 @@ licenses:
357
357
  - MIT
358
358
  metadata:
359
359
  bug_tracker_uri: https://github.com/rails/rails/issues
360
- changelog_uri: https://github.com/rails/rails/blob/v6.1.1/activesupport/CHANGELOG.md
361
- documentation_uri: https://api.rubyonrails.org/v6.1.1/
360
+ changelog_uri: https://github.com/rails/rails/blob/v6.1.4.1/activesupport/CHANGELOG.md
361
+ documentation_uri: https://api.rubyonrails.org/v6.1.4.1/
362
362
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
363
- source_code_uri: https://github.com/rails/rails/tree/v6.1.1/activesupport
363
+ source_code_uri: https://github.com/rails/rails/tree/v6.1.4.1/activesupport
364
364
  post_install_message:
365
365
  rdoc_options:
366
366
  - "--encoding"
@@ -378,7 +378,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
378
378
  - !ruby/object:Gem::Version
379
379
  version: '0'
380
380
  requirements: []
381
- rubygems_version: 3.2.3
381
+ rubygems_version: 3.2.15
382
382
  signing_key:
383
383
  specification_version: 4
384
384
  summary: A toolkit of support libraries and Ruby core extensions extracted from the