parent
0cd78450e1
commit
ed496447e5
@ -1,22 +0,0 @@
|
|||||||
From 598f10c00084f20e277b82ed83a8ef8bd85a1a78 Mon Sep 17 00:00:00 2001
|
|
||||||
From: utilum <oz@utilum.com>
|
|
||||||
Date: Thu, 15 Dec 2016 02:42:52 +0100
|
|
||||||
Subject: [PATCH] Fix Fixnum deprecated warning in Ruby 2.4+
|
|
||||||
|
|
||||||
---
|
|
||||||
activesupport/test/core_ext/duration_test.rb | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/activesupport/test/core_ext/duration_test.rb b/activesupport/test/core_ext/duration_test.rb
|
|
||||||
index 26a9ea4..6f7f16d 100644
|
|
||||||
--- a/activesupport/test/core_ext/duration_test.rb
|
|
||||||
+++ b/activesupport/test/core_ext/duration_test.rb
|
|
||||||
@@ -21,7 +21,7 @@ class << k; undef_method :== end
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_instance_of
|
|
||||||
- assert 1.minute.instance_of?(Fixnum)
|
|
||||||
+ assert 1.minute.instance_of?(1.class)
|
|
||||||
assert 2.days.instance_of?(ActiveSupport::Duration)
|
|
||||||
assert !3.second.instance_of?(Numeric)
|
|
||||||
end
|
|
@ -1,28 +0,0 @@
|
|||||||
From b552b5edaffe5dae183ece4d8475a0e7005da6c7 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Matthew Draper <matthew@trebex.net>
|
|
||||||
Date: Sat, 8 Oct 2016 10:50:36 +1030
|
|
||||||
Subject: [PATCH] Merge pull request #26732 from matthewd/fixnum-warning
|
|
||||||
|
|
||||||
Fixnum and Bignum are deprecated in Ruby trunk
|
|
||||||
---
|
|
||||||
activesupport/test/core_ext/array/grouping_test.rb | 4 ++--
|
|
||||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/activesupport/test/core_ext/array/grouping_test.rb b/activesupport/test/core_ext/array/grouping_test.rb
|
|
||||||
index 0682241..7479d8d 100644
|
|
||||||
--- a/activesupport/test/core_ext/array/grouping_test.rb
|
|
||||||
+++ b/activesupport/test/core_ext/array/grouping_test.rb
|
|
||||||
@@ -4,11 +4,11 @@
|
|
||||||
class GroupingTest < ActiveSupport::TestCase
|
|
||||||
def setup
|
|
||||||
# In Ruby < 2.4, test we avoid Integer#/ (redefined by mathn)
|
|
||||||
- Fixnum.send :private, :/ unless Fixnum == Integer
|
|
||||||
+ Fixnum.send :private, :/ unless 0.class == Integer
|
|
||||||
end
|
|
||||||
|
|
||||||
def teardown
|
|
||||||
- Fixnum.send :public, :/ unless Fixnum == Integer
|
|
||||||
+ Fixnum.send :public, :/ unless 0.class == Integer
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_in_groups_of_with_perfect_fit
|
|
@ -1,39 +0,0 @@
|
|||||||
From b552b5edaffe5dae183ece4d8475a0e7005da6c7 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Matthew Draper <matthew@trebex.net>
|
|
||||||
Date: Sat, 8 Oct 2016 10:50:36 +1030
|
|
||||||
Subject: [PATCH] Merge pull request #26732 from matthewd/fixnum-warning
|
|
||||||
|
|
||||||
Fixnum and Bignum are deprecated in Ruby trunk
|
|
||||||
---
|
|
||||||
activesupport/lib/active_support/core_ext/numeric/conversions.rb | 2 +-
|
|
||||||
activesupport/lib/active_support/xml_mini.rb | 4 ++--
|
|
||||||
2 files changed, 3 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/activesupport/lib/active_support/core_ext/numeric/conversions.rb b/activesupport/lib/active_support/core_ext/numeric/conversions.rb
|
|
||||||
index 6586a35..193f6b2 100644
|
|
||||||
--- a/activesupport/lib/active_support/core_ext/numeric/conversions.rb
|
|
||||||
+++ b/activesupport/lib/active_support/core_ext/numeric/conversions.rb
|
|
||||||
@@ -135,7 +135,7 @@ def to_formatted_s(*args)
|
|
||||||
end
|
|
||||||
|
|
||||||
# Ruby 2.4+ unifies Fixnum & Bignum into Integer.
|
|
||||||
-if Integer == Fixnum
|
|
||||||
+if 0.class == Integer
|
|
||||||
Integer.prepend ActiveSupport::NumericWithFormat
|
|
||||||
else
|
|
||||||
Fixnum.prepend ActiveSupport::NumericWithFormat
|
|
||||||
diff --git a/activesupport/lib/active_support/xml_mini.rb b/activesupport/lib/active_support/xml_mini.rb
|
|
||||||
index 99fc265..1812de0 100644
|
|
||||||
--- a/activesupport/lib/active_support/xml_mini.rb
|
|
||||||
+++ b/activesupport/lib/active_support/xml_mini.rb
|
|
||||||
@@ -48,8 +48,8 @@ def content_type
|
|
||||||
}
|
|
||||||
|
|
||||||
# No need to map these on Ruby 2.4+
|
|
||||||
- TYPE_NAMES["Fixnum"] = "integer" unless Fixnum == Integer
|
|
||||||
- TYPE_NAMES["Bignum"] = "integer" unless Bignum == Integer
|
|
||||||
+ TYPE_NAMES["Fixnum"] = "integer" unless 0.class == Integer
|
|
||||||
+ TYPE_NAMES["Bignum"] = "integer" unless 0.class == Integer
|
|
||||||
end
|
|
||||||
|
|
||||||
FORMATTING = {
|
|
@ -1,15 +0,0 @@
|
|||||||
diff --git a/activesupport/test/core_ext/object/duplicable_test.rb b/activesupport/test/core_ext/object/duplicable_test.rb
|
|
||||||
index c2d7c15..2e3b185 100644
|
|
||||||
--- a/activesupport/test/core_ext/object/duplicable_test.rb
|
|
||||||
+++ b/activesupport/test/core_ext/object/duplicable_test.rb
|
|
||||||
@@ -5,8 +5,8 @@
|
|
||||||
|
|
||||||
class DuplicableTest < ActiveSupport::TestCase
|
|
||||||
if RUBY_VERSION >= "2.4.0"
|
|
||||||
- RAISE_DUP = [method(:puts)]
|
|
||||||
- ALLOW_DUP = ["1", Object.new, /foo/, [], {}, Time.now, Class.new, Module.new, BigDecimal.new("4.56"), nil, false, true, :symbol, 1, 2.3]
|
|
||||||
+ RAISE_DUP = [method(:puts), 'symbol_from_string'.to_sym]
|
|
||||||
+ ALLOW_DUP = ["1", Object.new, /foo/, [], {}, Time.now, Class.new, Module.new, BigDecimal.new("4.56"), nil, false, true, 1, 2.3]
|
|
||||||
else
|
|
||||||
RAISE_DUP = [nil, false, true, :symbol, 1, 2.3, method(:puts)]
|
|
||||||
ALLOW_DUP = ["1", Object.new, /foo/, [], {}, Time.now, Class.new, Module.new, BigDecimal.new("4.56")]
|
|
@ -1,14 +0,0 @@
|
|||||||
diff --git a/activesupport/lib/active_support/core_ext/object/duplicable.rb b/activesupport/lib/active_support/core_ext/object/duplicable.rb
|
|
||||||
index d4bf8ce..58045d5 100644
|
|
||||||
--- a/activesupport/lib/active_support/core_ext/object/duplicable.rb
|
|
||||||
+++ b/activesupport/lib/active_support/core_ext/object/duplicable.rb
|
|
||||||
@@ -73,7 +73,8 @@ def duplicable?
|
|
||||||
|
|
||||||
class Symbol
|
|
||||||
begin
|
|
||||||
- :symbol.dup
|
|
||||||
+ :symbol.dup # Ruby 2.4.x.
|
|
||||||
+ 'symbol_from_string'.to_sym.dup # Some symbols can't `dup` in Ruby 2.4.0.
|
|
||||||
rescue TypeError
|
|
||||||
|
|
||||||
# Symbols are not duplicable:
|
|
@ -1,21 +0,0 @@
|
|||||||
diff --git a/activesupport/test/core_ext/object/duplicable_test.rb b/activesupport/test/core_ext/object/duplicable_test.rb
|
|
||||||
index 042f5cf..c2d7c15 100644
|
|
||||||
--- a/activesupport/test/core_ext/object/duplicable_test.rb
|
|
||||||
+++ b/activesupport/test/core_ext/object/duplicable_test.rb
|
|
||||||
@@ -4,9 +4,13 @@
|
|
||||||
require 'active_support/core_ext/numeric/time'
|
|
||||||
|
|
||||||
class DuplicableTest < ActiveSupport::TestCase
|
|
||||||
- RAISE_DUP = [nil, false, true, :symbol, 1, 2.3, method(:puts)]
|
|
||||||
- ALLOW_DUP = ['1', Object.new, /foo/, [], {}, Time.now, Class.new, Module.new]
|
|
||||||
- ALLOW_DUP << BigDecimal.new('4.56')
|
|
||||||
+ if RUBY_VERSION >= "2.4.0"
|
|
||||||
+ RAISE_DUP = [method(:puts)]
|
|
||||||
+ ALLOW_DUP = ["1", Object.new, /foo/, [], {}, Time.now, Class.new, Module.new, BigDecimal.new("4.56"), nil, false, true, :symbol, 1, 2.3]
|
|
||||||
+ else
|
|
||||||
+ RAISE_DUP = [nil, false, true, :symbol, 1, 2.3, method(:puts)]
|
|
||||||
+ ALLOW_DUP = ["1", Object.new, /foo/, [], {}, Time.now, Class.new, Module.new, BigDecimal.new("4.56")]
|
|
||||||
+ end
|
|
||||||
|
|
||||||
def test_duplicable
|
|
||||||
rubinius_skip "* Method#dup is allowed at the moment on Rubinius\n" \
|
|
@ -1,130 +0,0 @@
|
|||||||
diff --git a/activesupport/lib/active_support/core_ext/object/duplicable.rb b/activesupport/lib/active_support/core_ext/object/duplicable.rb
|
|
||||||
index 9bc5ee6..d4bf8ce 100644
|
|
||||||
--- a/activesupport/lib/active_support/core_ext/object/duplicable.rb
|
|
||||||
+++ b/activesupport/lib/active_support/core_ext/object/duplicable.rb
|
|
||||||
@@ -1,7 +1,7 @@
|
|
||||||
#--
|
|
||||||
-# Most objects are cloneable, but not all. For example you can't dup +nil+:
|
|
||||||
+# Most objects are cloneable, but not all. For example you can't dup methods:
|
|
||||||
#
|
|
||||||
-# nil.dup # => TypeError: can't dup NilClass
|
|
||||||
+# method(:puts).dup # => TypeError: allocator undefined for Method
|
|
||||||
#
|
|
||||||
# Classes may signal their instances are not duplicable removing +dup+/+clone+
|
|
||||||
# or raising exceptions from them. So, to dup an arbitrary object you normally
|
|
||||||
@@ -19,7 +19,7 @@
|
|
||||||
class Object
|
|
||||||
# Can you safely dup this object?
|
|
||||||
#
|
|
||||||
- # False for +nil+, +false+, +true+, symbol, number, method objects;
|
|
||||||
+ # False for method objects;
|
|
||||||
# true otherwise.
|
|
||||||
def duplicable?
|
|
||||||
true
|
|
||||||
@@ -27,52 +27,77 @@ def duplicable?
|
|
||||||
end
|
|
||||||
|
|
||||||
class NilClass
|
|
||||||
- # +nil+ is not duplicable:
|
|
||||||
- #
|
|
||||||
- # nil.duplicable? # => false
|
|
||||||
- # nil.dup # => TypeError: can't dup NilClass
|
|
||||||
- def duplicable?
|
|
||||||
- false
|
|
||||||
+ begin
|
|
||||||
+ nil.dup
|
|
||||||
+ rescue TypeError
|
|
||||||
+
|
|
||||||
+ # +nil+ is not duplicable:
|
|
||||||
+ #
|
|
||||||
+ # nil.duplicable? # => false
|
|
||||||
+ # nil.dup # => TypeError: can't dup NilClass
|
|
||||||
+ def duplicable?
|
|
||||||
+ false
|
|
||||||
+ end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
class FalseClass
|
|
||||||
- # +false+ is not duplicable:
|
|
||||||
- #
|
|
||||||
- # false.duplicable? # => false
|
|
||||||
- # false.dup # => TypeError: can't dup FalseClass
|
|
||||||
- def duplicable?
|
|
||||||
- false
|
|
||||||
+ begin
|
|
||||||
+ false.dup
|
|
||||||
+ rescue TypeError
|
|
||||||
+
|
|
||||||
+ # +false+ is not duplicable:
|
|
||||||
+ #
|
|
||||||
+ # false.duplicable? # => false
|
|
||||||
+ # false.dup # => TypeError: can't dup FalseClass
|
|
||||||
+ def duplicable?
|
|
||||||
+ false
|
|
||||||
+ end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
class TrueClass
|
|
||||||
- # +true+ is not duplicable:
|
|
||||||
- #
|
|
||||||
- # true.duplicable? # => false
|
|
||||||
- # true.dup # => TypeError: can't dup TrueClass
|
|
||||||
- def duplicable?
|
|
||||||
- false
|
|
||||||
+ begin
|
|
||||||
+ true.dup
|
|
||||||
+ rescue TypeError
|
|
||||||
+
|
|
||||||
+ # +true+ is not duplicable:
|
|
||||||
+ #
|
|
||||||
+ # true.duplicable? # => false
|
|
||||||
+ # true.dup # => TypeError: can't dup TrueClass
|
|
||||||
+ def duplicable?
|
|
||||||
+ false
|
|
||||||
+ end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
class Symbol
|
|
||||||
- # Symbols are not duplicable:
|
|
||||||
- #
|
|
||||||
- # :my_symbol.duplicable? # => false
|
|
||||||
- # :my_symbol.dup # => TypeError: can't dup Symbol
|
|
||||||
- def duplicable?
|
|
||||||
- false
|
|
||||||
+ begin
|
|
||||||
+ :symbol.dup
|
|
||||||
+ rescue TypeError
|
|
||||||
+
|
|
||||||
+ # Symbols are not duplicable:
|
|
||||||
+ #
|
|
||||||
+ # :my_symbol.duplicable? # => false
|
|
||||||
+ # :my_symbol.dup # => TypeError: can't dup Symbol
|
|
||||||
+ def duplicable?
|
|
||||||
+ false
|
|
||||||
+ end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
class Numeric
|
|
||||||
- # Numbers are not duplicable:
|
|
||||||
- #
|
|
||||||
- # 3.duplicable? # => false
|
|
||||||
- # 3.dup # => TypeError: can't dup Integer
|
|
||||||
- def duplicable?
|
|
||||||
- false
|
|
||||||
+ begin
|
|
||||||
+ 1.dup
|
|
||||||
+ rescue TypeError
|
|
||||||
+
|
|
||||||
+ # Numbers are not duplicable:
|
|
||||||
+ #
|
|
||||||
+ # 3.duplicable? # => false
|
|
||||||
+ # 3.dup # => TypeError: can't dup Integer
|
|
||||||
+ def duplicable?
|
|
||||||
+ false
|
|
||||||
+ end
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,35 +0,0 @@
|
|||||||
From c78410286672991cf6df25ef0a9f4529e6b2617b Mon Sep 17 00:00:00 2001
|
|
||||||
From: Akira Matsuda <ronnie@dio.jp>
|
|
||||||
Date: Sat, 5 Nov 2016 16:12:30 +0900
|
|
||||||
Subject: [PATCH] Tweaking some test data due to sprintf behavior change in 2.4
|
|
||||||
|
|
||||||
2.3: sprintf('%0.1f', 5.55) #=> "5.5"
|
|
||||||
2.4: sprintf('%0.1f', 5.55) #=> "5.6"
|
|
||||||
|
|
||||||
see: https://github.com/ruby/ruby/commit/6ed8c79ddb11ccfb580bb0a22b22cc1362250255 and
|
|
||||||
https://github.com/ruby/ruby/commit/295f60b94d5ff6551fab7c55e18d1ffa6a4cf7e3
|
|
||||||
---
|
|
||||||
activesupport/test/core_ext/duration_test.rb | 10 +++++-----
|
|
||||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/activesupport/test/core_ext/duration_test.rb b/activesupport/test/core_ext/duration_test.rb
|
|
||||||
index 15aee91..9fea9ab 100644
|
|
||||||
--- a/activesupport/test/core_ext/duration_test.rb
|
|
||||||
+++ b/activesupport/test/core_ext/duration_test.rb
|
|
||||||
@@ -287,11 +287,11 @@ def test_iso8601_output
|
|
||||||
|
|
||||||
def test_iso8601_output_precision
|
|
||||||
expectations = [
|
|
||||||
- [nil, 'P1Y1MT5.55S', 1.year + 1.month + (5.55).seconds ],
|
|
||||||
- [0, 'P1Y1MT6S', 1.year + 1.month + (5.55).seconds ],
|
|
||||||
- [1, 'P1Y1MT5.5S', 1.year + 1.month + (5.55).seconds ],
|
|
||||||
- [2, 'P1Y1MT5.55S', 1.year + 1.month + (5.55).seconds ],
|
|
||||||
- [3, 'P1Y1MT5.550S', 1.year + 1.month + (5.55).seconds ],
|
|
||||||
+ [nil, 'P1Y1MT8.55S', 1.year + 1.month + (8.55).seconds ],
|
|
||||||
+ [0, 'P1Y1MT9S', 1.year + 1.month + (8.55).seconds ],
|
|
||||||
+ [1, 'P1Y1MT8.6S', 1.year + 1.month + (8.55).seconds ],
|
|
||||||
+ [2, 'P1Y1MT8.55S', 1.year + 1.month + (8.55).seconds ],
|
|
||||||
+ [3, 'P1Y1MT8.550S', 1.year + 1.month + (8.55).seconds ],
|
|
||||||
[nil, 'PT1S', 1.second ],
|
|
||||||
[2, 'PT1.00S', 1.second ],
|
|
||||||
[nil, 'PT1.4S', (1.4).seconds ],
|
|
@ -1,34 +0,0 @@
|
|||||||
From b3d811781ec24e5bc3710c62cedac472b7999082 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Akira Matsuda <ronnie@dio.jp>
|
|
||||||
Date: Mon, 12 Dec 2016 23:41:59 +0900
|
|
||||||
Subject: [PATCH] Keep AS::XmlMini::PARSING["decimal"].call('') returning 0
|
|
||||||
|
|
||||||
BigDecimal('an invalid string') has changed its behavior to raise an ArgumentError since 1.3.0
|
|
||||||
https://bugs.ruby-lang.org/issues/10286
|
|
||||||
---
|
|
||||||
activesupport/lib/active_support/xml_mini.rb | 12 +++++++++++-
|
|
||||||
1 file changed, 11 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/activesupport/lib/active_support/xml_mini.rb b/activesupport/lib/active_support/xml_mini.rb
|
|
||||||
index 1812de0..5275c0e 100644
|
|
||||||
--- a/activesupport/lib/active_support/xml_mini.rb
|
|
||||||
+++ b/activesupport/lib/active_support/xml_mini.rb
|
|
||||||
@@ -68,7 +68,17 @@ def content_type
|
|
||||||
"datetime" => Proc.new { |time| Time.xmlschema(time).utc rescue ::DateTime.parse(time).utc },
|
|
||||||
"integer" => Proc.new { |integer| integer.to_i },
|
|
||||||
"float" => Proc.new { |float| float.to_f },
|
|
||||||
- "decimal" => Proc.new { |number| BigDecimal(number) },
|
|
||||||
+ "decimal" => Proc.new do |number|
|
|
||||||
+ if String === number
|
|
||||||
+ begin
|
|
||||||
+ BigDecimal(number)
|
|
||||||
+ rescue ArgumentError
|
|
||||||
+ BigDecimal('0')
|
|
||||||
+ end
|
|
||||||
+ else
|
|
||||||
+ BigDecimal(number)
|
|
||||||
+ end
|
|
||||||
+ end,
|
|
||||||
"boolean" => Proc.new { |boolean| %w(1 true).include?(boolean.to_s.strip) },
|
|
||||||
"string" => Proc.new { |string| string.to_s },
|
|
||||||
"yaml" => Proc.new { |yaml| YAML::load(yaml) rescue yaml },
|
|
@ -1,22 +0,0 @@
|
|||||||
From 8683ac5983ddfd8b47b6aac6ab51269611610f42 Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Rafael=20Fran=C3=A7a?= <rafaelmfranca@gmail.com>
|
|
||||||
Date: Sun, 13 Nov 2016 19:58:52 -0500
|
|
||||||
Subject: [PATCH] Merge pull request #27033 from vipulnsward/fix-bignum-warning
|
|
||||||
|
|
||||||
Remove warning from Bignum constant access
|
|
||||||
---
|
|
||||||
activesupport/test/core_ext/numeric_ext_test.rb | 1 -
|
|
||||||
1 file changed, 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/activesupport/test/core_ext/numeric_ext_test.rb b/activesupport/test/core_ext/numeric_ext_test.rb
|
|
||||||
index 69c30a8..79a4802 100644
|
|
||||||
--- a/activesupport/test/core_ext/numeric_ext_test.rb
|
|
||||||
+++ b/activesupport/test/core_ext/numeric_ext_test.rb
|
|
||||||
@@ -425,7 +425,6 @@ def test_in_milliseconds
|
|
||||||
|
|
||||||
# TODO: Remove positive and negative tests when we drop support to ruby < 2.3
|
|
||||||
b = 2**64
|
|
||||||
- b *= b until Bignum === b
|
|
||||||
|
|
||||||
T_ZERO = b.coerce(0).first
|
|
||||||
T_ONE = b.coerce(1).first
|
|
@ -1,2 +1,2 @@
|
|||||||
SHA512 (activesupport-5.0.1-tests.tgz) = b3cd01915bc9b77dd7094583b6aed5988fb2f66b8ca0e5671db18c8abc4b990d1f56a3df9fc9cc2bbd35d5e2d1666678059c5046933f93266b726957b8736bf5
|
SHA512 (activesupport-5.0.2-tests.tgz) = e73d3a0165aa9e80365a48d3f71550fb7ce00f7b41ba51968467027cd24528880adb4563d4a57c6756867d844d42d19698470c3b8453f06274b10dacbfe5d0c0
|
||||||
SHA512 (activesupport-5.0.1.gem) = df9f4f342a64ef5839698d48d0271b8104db0d18cf069d1fe292956ea11f7e3886b545eb60ab1679050e964c05d8304bca042e50f1013ca250c4d2661fd9d4f2
|
SHA512 (activesupport-5.0.2.gem) = 6f3d26d6a6cdcfcbd069f2e7f1062e312e7572e0dcd6fe1d9b3f0d01c3eab81967935bd014043fb08e8a3c1f4b7730ccd718b46203673d6a0cbaed79c39c6bb0
|
||||||
|
Loading…
Reference in new issue