activesupport 6.1.3.2 → 6.1.4

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: 79de516b16a70e3ae9100d8f6a35deca4f3dec0f3c080ea4c44debdfdddb11d0
4
- data.tar.gz: 187bd3a2e457d13669cd200ad633508bc8601225cadee1688ef17847d49da6ae
3
+ metadata.gz: da0f0bd22c59fddaba8fe79a42f798bddb4d656d8a4f8995a306a6b5f50f4af9
4
+ data.tar.gz: 5da2fbc27b148858fa687cb18014f4d3207c2c67d46baaaba37fd84a5e6af7cd
5
5
  SHA512:
6
- metadata.gz: 0b7a231bd4b8c8d8feb1d84150c1217afa22c221150e562689ea70e761f5a2c67e1db8dfda5daa3832d3a61d864769cb922f3b5e0b6f797a101be34fdcea2b43
7
- data.tar.gz: 5964297423a93328267eafbe48ed68828d38d0c8040b0765ecfa2da24bb0edbcab537caf00993c6e5d9859be37d5d3ea79f557981f212a6f76f7454177110e18
6
+ metadata.gz: 3340ccef27050ca727f293fcf4ff0f32f5e5157959c7ee098aab016089a959c54eb83be8d944c46e2131b9f4ea19957dd9169b7bf7ec41eab8952f73602a4aea
7
+ data.tar.gz: 78546d89d1f742d9faf4714aa18ba45796eef8a84149e137aa4357e1ec6dffd5e5b0c3c20c1c67d50d0898cd27fce00d715fdf172e3ca20fcbdeffeab30c5a0d
data/CHANGELOG.md CHANGED
@@ -1,3 +1,34 @@
1
+ ## Rails 6.1.4 (June 24, 2021) ##
2
+
3
+ * MemCacheStore: convert any underlying value (including `false`) to an `Entry`.
4
+
5
+ See [#42559](https://github.com/rails/rails/pull/42559).
6
+
7
+ *Alex Ghiculescu*
8
+
9
+ * Fix bug in `number_with_precision` when using large `BigDecimal` values.
10
+
11
+ Fixes #42302.
12
+
13
+ *Federico Aldunate*, *Zachary Scott*
14
+
15
+ * Check byte size instead of length on `secure_compare`.
16
+
17
+ *Tietew*
18
+
19
+ * Fix `Time.at` to not lose `:in` option.
20
+
21
+ *Ryuta Kamizono*
22
+
23
+ * Require a path for `config.cache_store = :file_store`.
24
+
25
+ *Alex Ghiculescu*
26
+
27
+ * Avoid having to store complex object in the default translation file.
28
+
29
+ *Rafael Mendonça França*
30
+
31
+
1
32
  ## Rails 6.1.3.2 (May 05, 2021) ##
2
33
 
3
34
  * No changes.
@@ -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
@@ -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
@@ -198,7 +198,7 @@ module ActiveSupport
198
198
 
199
199
  def deserialize_entry(payload)
200
200
  entry = super
201
- 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)
202
202
  entry
203
203
  end
204
204
 
@@ -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. " \
@@ -42,14 +42,8 @@ class Time
42
42
 
43
43
  # Layers additional behavior on Time.at so that ActiveSupport::TimeWithZone and DateTime
44
44
  # instances can be used when called with a single argument
45
- def at_with_coercion(*args, **kwargs)
46
- if args.size != 1
47
- if kwargs.empty?
48
- return at_without_coercion(*args)
49
- else
50
- return at_without_coercion(*args, **kwargs)
51
- end
52
- end
45
+ def at_with_coercion(*args)
46
+ return at_without_coercion(*args) if args.size != 1
53
47
 
54
48
  # Time.at can be called with a time or numerical value
55
49
  time_or_number = args.first
@@ -62,6 +56,7 @@ class Time
62
56
  at_without_coercion(time_or_number)
63
57
  end
64
58
  end
59
+ ruby2_keywords(:at_with_coercion) if respond_to?(:ruby2_keywords, true)
65
60
  alias_method :at_without_coercion, :at
66
61
  alias_method :at, :at_with_coercion
67
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 = 3
13
- PRE = "2"
12
+ TINY = 4
13
+ PRE = nil
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
@@ -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
@@ -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
 
@@ -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
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.3.2
4
+ version: 6.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-05 00:00:00.000000000 Z
11
+ date: 2021-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -357,11 +357,11 @@ 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.3.2/activesupport/CHANGELOG.md
361
- documentation_uri: https://api.rubyonrails.org/v6.1.3.2/
360
+ changelog_uri: https://github.com/rails/rails/blob/v6.1.4/activesupport/CHANGELOG.md
361
+ documentation_uri: https://api.rubyonrails.org/v6.1.4/
362
362
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
363
- source_code_uri: https://github.com/rails/rails/tree/v6.1.3.2/activesupport
364
- post_install_message:
363
+ source_code_uri: https://github.com/rails/rails/tree/v6.1.4/activesupport
364
+ post_install_message:
365
365
  rdoc_options:
366
366
  - "--encoding"
367
367
  - UTF-8
@@ -379,7 +379,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
379
379
  version: '0'
380
380
  requirements: []
381
381
  rubygems_version: 3.1.2
382
- signing_key:
382
+ signing_key:
383
383
  specification_version: 4
384
384
  summary: A toolkit of support libraries and Ruby core extensions extracted from the
385
385
  Rails framework.