activesupport 5.2.2.1 → 5.2.3.rc1

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: 8f85b76a4258720d6ec697ba09ca8417c9898bc8b85cde9533f1ea8017d4373d
4
- data.tar.gz: b74ac1958cd6df321c1975439ddc1511f8c624498804e83fc15f16691b7d2683
3
+ metadata.gz: 1cd82674eef103363f70300277378b5087a213819c71c6d58b7fd211b66be66b
4
+ data.tar.gz: a98d5f1f4d7081fc6c12f66a3bf66fe7b5cce02e8124dc2460d412f70a3b1f6f
5
5
  SHA512:
6
- metadata.gz: 9f81fa3dff61091986dacb3a5d1aa407d51056be96fdeff5a284395c1b7b115992ae56b9ac880d7fc5f790f0e8e67f71af045ccc84d7362dfedf091598e57dc9
7
- data.tar.gz: 4026828e4898d47ffc43ca05b4d558aa5fd5d27247f87d0c750021b684bceccff274d4d49d1c8e1839a0af17f3a8006f0fc78214e57173f1aea5465326f7474a
6
+ metadata.gz: 67574e498b627637cf33961a71561caf7edb3271e69965a6f66c2337e35012f165cfb037a1c9b98b5f255a3e69c267552532c7b017f481dc86c8a0f3d6ea720e
7
+ data.tar.gz: c5382a9877d5b6969eef3e0a84b5a3f2c6e3b450a54bd7e56a68e4338dd5804bf11cc9faae3060b353c5c184e867ec1877535057ddd18be8d487efd65b2cf640
@@ -1,3 +1,28 @@
1
+ ## Rails 5.2.3.rc1 (March 21, 2019) ##
2
+
3
+ * Add `ActiveSupport::HashWithIndifferentAccess#assoc`.
4
+
5
+ `assoc` can now be called with either a string or a symbol.
6
+
7
+ *Stefan Schüßler*
8
+
9
+ * Fix `String#safe_constantize` throwing a `LoadError` for incorrectly cased constant references.
10
+
11
+ *Keenan Brock*
12
+
13
+ * Allow Range#=== and Range#cover? on Range
14
+
15
+ `Range#cover?` can now accept a range argument like `Range#include?` and
16
+ `Range#===`. `Range#===` works correctly on Ruby 2.6. `Range#include?` is moved
17
+ into a new file, with these two methods.
18
+
19
+ *utilum*
20
+
21
+ * If the same block is `included` multiple times for a Concern, an exception is no longer raised.
22
+
23
+ *Mark J. Titorenko*, *Vlad Bokov*
24
+
25
+
1
26
  ## Rails 5.2.2.1 (March 11, 2019) ##
2
27
 
3
28
  * No changes.
@@ -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
@@ -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,8 +9,8 @@ module ActiveSupport
9
9
  module VERSION
10
10
  MAJOR = 5
11
11
  MINOR = 2
12
- TINY = 2
13
- PRE = "1"
12
+ TINY = 3
13
+ PRE = "rc1"
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
@@ -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
@@ -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.1
4
+ version: 5.2.3.rc1
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: 2019-03-13 00:00:00.000000000 Z
11
+ date: 2019-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -197,6 +197,7 @@ files:
197
197
  - lib/active_support/core_ext/object/try.rb
198
198
  - lib/active_support/core_ext/object/with_options.rb
199
199
  - lib/active_support/core_ext/range.rb
200
+ - lib/active_support/core_ext/range/compare_range.rb
200
201
  - lib/active_support/core_ext/range/conversions.rb
201
202
  - lib/active_support/core_ext/range/each.rb
202
203
  - lib/active_support/core_ext/range/include_range.rb
@@ -331,8 +332,8 @@ homepage: http://rubyonrails.org
331
332
  licenses:
332
333
  - MIT
333
334
  metadata:
334
- source_code_uri: https://github.com/rails/rails/tree/v5.2.2.1/activesupport
335
- changelog_uri: https://github.com/rails/rails/blob/v5.2.2.1/activesupport/CHANGELOG.md
335
+ source_code_uri: https://github.com/rails/rails/tree/v5.2.3.rc1/activesupport
336
+ changelog_uri: https://github.com/rails/rails/blob/v5.2.3.rc1/activesupport/CHANGELOG.md
336
337
  post_install_message:
337
338
  rdoc_options:
338
339
  - "--encoding"
@@ -346,9 +347,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
346
347
  version: 2.2.2
347
348
  required_rubygems_version: !ruby/object:Gem::Requirement
348
349
  requirements:
349
- - - ">="
350
+ - - ">"
350
351
  - !ruby/object:Gem::Version
351
- version: '0'
352
+ version: 1.3.1
352
353
  requirements: []
353
354
  rubygems_version: 3.0.1
354
355
  signing_key: