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 +4 -4
- data/CHANGELOG.md +25 -0
- data/lib/active_support/concern.rb +7 -3
- data/lib/active_support/core_ext/range.rb +1 -1
- data/lib/active_support/core_ext/range/compare_range.rb +61 -0
- data/lib/active_support/core_ext/range/include_range.rb +1 -23
- data/lib/active_support/deprecation/method_wrappers.rb +24 -14
- data/lib/active_support/gem_version.rb +2 -2
- data/lib/active_support/hash_with_indifferent_access.rb +13 -0
- data/lib/active_support/inflector/methods.rb +2 -0
- data/lib/active_support/xml_mini.rb +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1cd82674eef103363f70300277378b5087a213819c71c6d58b7fd211b66be66b
|
4
|
+
data.tar.gz: a98d5f1f4d7081fc6c12f66a3bf66fe7b5cce02e8124dc2460d412f70a3b1f6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67574e498b627637cf33961a71561caf7edb3271e69965a6f66c2337e35012f165cfb037a1c9b98b5f255a3e69c267552532c7b017f481dc86c8a0f3d6ea720e
|
7
|
+
data.tar.gz: c5382a9877d5b6969eef3e0a84b5a3f2c6e3b450a54bd7e56a68e4338dd5804bf11cc9faae3060b353c5c184e867ec1877535057ddd18be8d487efd65b2cf640
|
data/CHANGELOG.md
CHANGED
@@ -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
|
-
|
129
|
-
|
130
|
-
|
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/
|
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
|
-
|
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
|
-
|
59
|
-
|
60
|
-
|
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
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
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
|
-
|
68
|
-
|
69
|
+
target_module.send(:alias_method, without_method, method_name)
|
70
|
+
target_module.send(:alias_method, method_name, with_method)
|
69
71
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
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
|
@@ -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
|
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.
|
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-
|
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.
|
335
|
-
changelog_uri: https://github.com/rails/rails/blob/v5.2.
|
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:
|
352
|
+
version: 1.3.1
|
352
353
|
requirements: []
|
353
354
|
rubygems_version: 3.0.1
|
354
355
|
signing_key:
|