activesupport 5.2.2 → 5.2.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: 28ba8a573798735113cf64c0bd1ffd7e2bddb6b81be4b9feca484a4543f59c66
4
- data.tar.gz: ca185b08c32e2ce148c0ea786ad508ecd7385878cfe6f442d81115d72dbd4d7b
3
+ metadata.gz: 1fd0afb64741d8e794acec9c74cca9ed2526e30ac7c78e5b66135bfc2567a187
4
+ data.tar.gz: 33b2caf831d3c6907351646dbe4ab033b810adcdf0737a627e712b50782b7ed7
5
5
  SHA512:
6
- metadata.gz: ea921839a1a4dcf213a4a057a08e869ec41e557d6602f719537edfd1293cf4115e58e7e3b00133386116197d093ac06c011b903fa69d604abebe92a7c488ea94
7
- data.tar.gz: 017ee32c83d1456e7050c2b4770635375240ce7aa36433edf27a8f525b7b23cf1cc930e19f28b0f77e633b8430b22a5f3a6000a186985ee1fabf72e87c4ad3d5
6
+ metadata.gz: 5a78f3d685d14d51a926f0cc38d800bc0440d8f71fd1198fbe9842cccfb12875b4930377da6681518aa4c473bbc0a0cd8b65067916dedbf7a7b07a1815fcc1b6
7
+ data.tar.gz: 4c32299fa0aa0c61e5a415c10aa152b3bb9bf286b3836914fed1458fb43183ad8ee38908dd0af59403edfc3f062dc5f4e11772305f1abc599f3ddd0c90c211dc
@@ -1,3 +1,68 @@
1
+ ## Rails 5.2.4 (November 27, 2019) ##
2
+
3
+ * Make ActiveSupport::Logger Fiber-safe. Fixes #36752.
4
+
5
+ Use `Fiber.current.__id__` in `ActiveSupport::Logger#local_level=` in order
6
+ to make log level local to Ruby Fibers in addition to Threads.
7
+
8
+ Example:
9
+
10
+ logger = ActiveSupport::Logger.new(STDOUT)
11
+ logger.level = 1
12
+ p "Main is debug? #{logger.debug?}"
13
+
14
+ Fiber.new {
15
+ logger.local_level = 0
16
+ p "Thread is debug? #{logger.debug?}"
17
+ }.resume
18
+
19
+ p "Main is debug? #{logger.debug?}"
20
+
21
+ Before:
22
+
23
+ Main is debug? false
24
+ Thread is debug? true
25
+ Main is debug? true
26
+
27
+ After:
28
+
29
+ Main is debug? false
30
+ Thread is debug? true
31
+ Main is debug? false
32
+
33
+ *Alexander Varnin*
34
+
35
+
36
+ ## Rails 5.2.3 (March 27, 2019) ##
37
+
38
+ * Add `ActiveSupport::HashWithIndifferentAccess#assoc`.
39
+
40
+ `assoc` can now be called with either a string or a symbol.
41
+
42
+ *Stefan Schüßler*
43
+
44
+ * Fix `String#safe_constantize` throwing a `LoadError` for incorrectly cased constant references.
45
+
46
+ *Keenan Brock*
47
+
48
+ * Allow Range#=== and Range#cover? on Range
49
+
50
+ `Range#cover?` can now accept a range argument like `Range#include?` and
51
+ `Range#===`. `Range#===` works correctly on Ruby 2.6. `Range#include?` is moved
52
+ into a new file, with these two methods.
53
+
54
+ *utilum*
55
+
56
+ * If the same block is `included` multiple times for a Concern, an exception is no longer raised.
57
+
58
+ *Mark J. Titorenko*, *Vlad Bokov*
59
+
60
+
61
+ ## Rails 5.2.2.1 (March 11, 2019) ##
62
+
63
+ * No changes.
64
+
65
+
1
66
  ## Rails 5.2.2 (December 04, 2018) ##
2
67
 
3
68
  * Fix bug where `#to_options` for `ActiveSupport::HashWithIndifferentAccess`
@@ -125,9 +125,13 @@ module ActiveSupport
125
125
 
126
126
  def included(base = nil, &block)
127
127
  if base.nil?
128
- raise MultipleIncludedBlocks if instance_variable_defined?(:@_included_block)
129
-
130
- @_included_block = block
128
+ if instance_variable_defined?(:@_included_block)
129
+ if @_included_block.source_location != block.source_location
130
+ raise MultipleIncludedBlocks
131
+ end
132
+ else
133
+ @_included_block = block
134
+ end
131
135
  else
132
136
  super
133
137
  end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "active_support/core_ext/digest/uuid"
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "active_support/core_ext/range/conversions"
4
- require "active_support/core_ext/range/include_range"
4
+ require "active_support/core_ext/range/compare_range"
5
5
  require "active_support/core_ext/range/include_time_with_zone"
6
6
  require "active_support/core_ext/range/overlaps"
7
7
  require "active_support/core_ext/range/each"
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActiveSupport
4
+ module CompareWithRange #:nodoc:
5
+ # Extends the default Range#=== to support range comparisons.
6
+ # (1..5) === (1..5) # => true
7
+ # (1..5) === (2..3) # => true
8
+ # (1..5) === (2..6) # => false
9
+ #
10
+ # The native Range#=== behavior is untouched.
11
+ # ('a'..'f') === ('c') # => true
12
+ # (5..9) === (11) # => false
13
+ def ===(value)
14
+ if value.is_a?(::Range)
15
+ # 1...10 includes 1..9 but it does not include 1..10.
16
+ operator = exclude_end? && !value.exclude_end? ? :< : :<=
17
+ super(value.first) && value.last.send(operator, last)
18
+ else
19
+ super
20
+ end
21
+ end
22
+
23
+ # Extends the default Range#include? to support range comparisons.
24
+ # (1..5).include?(1..5) # => true
25
+ # (1..5).include?(2..3) # => true
26
+ # (1..5).include?(2..6) # => false
27
+ #
28
+ # The native Range#include? behavior is untouched.
29
+ # ('a'..'f').include?('c') # => true
30
+ # (5..9).include?(11) # => false
31
+ def include?(value)
32
+ if value.is_a?(::Range)
33
+ # 1...10 includes 1..9 but it does not include 1..10.
34
+ operator = exclude_end? && !value.exclude_end? ? :< : :<=
35
+ super(value.first) && value.last.send(operator, last)
36
+ else
37
+ super
38
+ end
39
+ end
40
+
41
+ # Extends the default Range#cover? to support range comparisons.
42
+ # (1..5).cover?(1..5) # => true
43
+ # (1..5).cover?(2..3) # => true
44
+ # (1..5).cover?(2..6) # => false
45
+ #
46
+ # The native Range#cover? behavior is untouched.
47
+ # ('a'..'f').cover?('c') # => true
48
+ # (5..9).cover?(11) # => false
49
+ def cover?(value)
50
+ if value.is_a?(::Range)
51
+ # 1...10 covers 1..9 but it does not cover 1..10.
52
+ operator = exclude_end? && !value.exclude_end? ? :< : :<=
53
+ super(value.first) && value.last.send(operator, last)
54
+ else
55
+ super
56
+ end
57
+ end
58
+ end
59
+ end
60
+
61
+ Range.prepend(ActiveSupport::CompareWithRange)
@@ -1,25 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module ActiveSupport
4
- module IncludeWithRange #:nodoc:
5
- # Extends the default Range#include? to support range comparisons.
6
- # (1..5).include?(1..5) # => true
7
- # (1..5).include?(2..3) # => true
8
- # (1..5).include?(2..6) # => false
9
- #
10
- # The native Range#include? behavior is untouched.
11
- # ('a'..'f').include?('c') # => true
12
- # (5..9).include?(11) # => false
13
- def include?(value)
14
- if value.is_a?(::Range)
15
- # 1...10 includes 1..9 but it does not include 1..10.
16
- operator = exclude_end? && !value.exclude_end? ? :< : :<=
17
- super(value.first) && value.last.send(operator, last)
18
- else
19
- super
20
- end
21
- end
22
- end
23
- end
24
-
25
- Range.prepend(ActiveSupport::IncludeWithRange)
3
+ require "active_support/core_ext/range/compare_range"
@@ -53,27 +53,37 @@ module ActiveSupport
53
53
  options = method_names.extract_options!
54
54
  deprecator = options.delete(:deprecator) || self
55
55
  method_names += options.keys
56
+ mod = Module.new
56
57
 
57
58
  method_names.each do |method_name|
58
- aliased_method, punctuation = method_name.to_s.sub(/([?!=])$/, ""), $1
59
- with_method = "#{aliased_method}_with_deprecation#{punctuation}"
60
- without_method = "#{aliased_method}_without_deprecation#{punctuation}"
59
+ if target_module.method_defined?(method_name) || target_module.private_method_defined?(method_name)
60
+ aliased_method, punctuation = method_name.to_s.sub(/([?!=])$/, ""), $1
61
+ with_method = "#{aliased_method}_with_deprecation#{punctuation}"
62
+ without_method = "#{aliased_method}_without_deprecation#{punctuation}"
61
63
 
62
- target_module.send(:define_method, with_method) do |*args, &block|
63
- deprecator.deprecation_warning(method_name, options[method_name])
64
- send(without_method, *args, &block)
65
- end
64
+ target_module.send(:define_method, with_method) do |*args, &block|
65
+ deprecator.deprecation_warning(method_name, options[method_name])
66
+ send(without_method, *args, &block)
67
+ end
66
68
 
67
- target_module.send(:alias_method, without_method, method_name)
68
- target_module.send(:alias_method, method_name, with_method)
69
+ target_module.send(:alias_method, without_method, method_name)
70
+ target_module.send(:alias_method, method_name, with_method)
69
71
 
70
- case
71
- when target_module.protected_method_defined?(without_method)
72
- target_module.send(:protected, method_name)
73
- when target_module.private_method_defined?(without_method)
74
- target_module.send(:private, method_name)
72
+ case
73
+ when target_module.protected_method_defined?(without_method)
74
+ target_module.send(:protected, method_name)
75
+ when target_module.private_method_defined?(without_method)
76
+ target_module.send(:private, method_name)
77
+ end
78
+ else
79
+ mod.send(:define_method, method_name) do |*args, &block|
80
+ deprecator.deprecation_warning(method_name, options[method_name])
81
+ super(*args, &block)
82
+ end
75
83
  end
76
84
  end
85
+
86
+ target_module.prepend(mod) unless mod.instance_methods(false).empty?
77
87
  end
78
88
  end
79
89
  end
@@ -9,7 +9,7 @@ module ActiveSupport
9
9
  module VERSION
10
10
  MAJOR = 5
11
11
  MINOR = 2
12
- TINY = 2
12
+ TINY = 4
13
13
  PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
@@ -163,6 +163,19 @@ module ActiveSupport
163
163
  super(convert_key(key))
164
164
  end
165
165
 
166
+ # Same as <tt>Hash#assoc</tt> where the key passed as argument can be
167
+ # either a string or a symbol:
168
+ #
169
+ # counters = ActiveSupport::HashWithIndifferentAccess.new
170
+ # counters[:foo] = 1
171
+ #
172
+ # counters.assoc('foo') # => ["foo", 1]
173
+ # counters.assoc(:foo) # => ["foo", 1]
174
+ # counters.assoc(:zoo) # => nil
175
+ def assoc(key)
176
+ super(convert_key(key))
177
+ end
178
+
166
179
  # Same as <tt>Hash#fetch</tt> where the key passed as argument can be
167
180
  # either a string or a symbol:
168
181
  #
@@ -329,6 +329,8 @@ module ActiveSupport
329
329
  e.name.to_s == camel_cased_word.to_s)
330
330
  rescue ArgumentError => e
331
331
  raise unless /not missing constant #{const_regexp(camel_cased_word)}!$/.match?(e.message)
332
+ rescue LoadError => e
333
+ raise unless /Unable to autoload constant #{const_regexp(camel_cased_word)}/.match?(e.message)
332
334
  end
333
335
 
334
336
  # Returns the suffix that should be added to a number to denote the position
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "active_support/concern"
4
+ require "fiber"
4
5
 
5
6
  module ActiveSupport
6
7
  module LoggerThreadSafeLevel # :nodoc:
@@ -11,7 +12,7 @@ module ActiveSupport
11
12
  end
12
13
 
13
14
  def local_log_id
14
- Thread.current.__id__
15
+ Fiber.current.__id__
15
16
  end
16
17
 
17
18
  def local_level
@@ -18,8 +18,8 @@ module ActiveSupport
18
18
  super
19
19
  end
20
20
 
21
- def subscribe(pattern = nil, block = Proc.new)
22
- subscriber = Subscribers.new pattern, block
21
+ def subscribe(pattern = nil, callable = nil, &block)
22
+ subscriber = Subscribers.new(pattern, callable || block)
23
23
  synchronize do
24
24
  @subscribers << subscriber
25
25
  @listeners_for.clear
@@ -39,7 +39,7 @@ module ActiveSupport
39
39
  end
40
40
 
41
41
  def method_missing(name, *args)
42
- name_string = name.to_s
42
+ name_string = name.to_s.dup
43
43
  if name_string.chomp!("=")
44
44
  self[name_string] = args.first
45
45
  else
@@ -75,7 +75,7 @@ module ActiveSupport
75
75
  begin
76
76
  BigDecimal(number)
77
77
  rescue ArgumentError
78
- BigDecimal("0")
78
+ BigDecimal(number.to_f.to_s)
79
79
  end
80
80
  else
81
81
  BigDecimal(number)
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: 5.2.2
4
+ version: 5.2.4
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: 2018-12-04 00:00:00.000000000 Z
11
+ date: 2019-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -139,6 +139,7 @@ files:
139
139
  - lib/active_support/core_ext/date_time/calculations.rb
140
140
  - lib/active_support/core_ext/date_time/compatibility.rb
141
141
  - lib/active_support/core_ext/date_time/conversions.rb
142
+ - lib/active_support/core_ext/digest.rb
142
143
  - lib/active_support/core_ext/digest/uuid.rb
143
144
  - lib/active_support/core_ext/enumerable.rb
144
145
  - lib/active_support/core_ext/file.rb
@@ -197,6 +198,7 @@ files:
197
198
  - lib/active_support/core_ext/object/try.rb
198
199
  - lib/active_support/core_ext/object/with_options.rb
199
200
  - lib/active_support/core_ext/range.rb
201
+ - lib/active_support/core_ext/range/compare_range.rb
200
202
  - lib/active_support/core_ext/range/conversions.rb
201
203
  - lib/active_support/core_ext/range/each.rb
202
204
  - lib/active_support/core_ext/range/include_range.rb
@@ -331,8 +333,8 @@ homepage: http://rubyonrails.org
331
333
  licenses:
332
334
  - MIT
333
335
  metadata:
334
- source_code_uri: https://github.com/rails/rails/tree/v5.2.2/activesupport
335
- changelog_uri: https://github.com/rails/rails/blob/v5.2.2/activesupport/CHANGELOG.md
336
+ source_code_uri: https://github.com/rails/rails/tree/v5.2.4/activesupport
337
+ changelog_uri: https://github.com/rails/rails/blob/v5.2.4/activesupport/CHANGELOG.md
336
338
  post_install_message:
337
339
  rdoc_options:
338
340
  - "--encoding"
@@ -350,8 +352,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
350
352
  - !ruby/object:Gem::Version
351
353
  version: '0'
352
354
  requirements: []
353
- rubyforge_project:
354
- rubygems_version: 2.7.6
355
+ rubygems_version: 3.0.3
355
356
  signing_key:
356
357
  specification_version: 4
357
358
  summary: A toolkit of support libraries and Ruby core extensions extracted from the