parent
2fc28ff854
commit
81f0c1db6a
@ -0,0 +1,34 @@
|
||||
From 91d852fe2c6a6bf51287a1ad95ef6e21ffa9d261 Mon Sep 17 00:00:00 2001
|
||||
From: Eugene Kenny <elkenny@gmail.com>
|
||||
Date: Fri, 1 Jan 2021 16:05:37 +0000
|
||||
Subject: [PATCH] Fix rounding NaN and Infinity on newer BigDecimal
|
||||
|
||||
Since BigDecimal 2.0.3, BigDecimal#round returns an integer if the
|
||||
requested precision is less than 1:
|
||||
https://github.com/ruby/bigdecimal/commit/e8fc98050167fd943574609988b8754414e0a7c1
|
||||
|
||||
NaN and Infinity cannot be represented as an integer, so rounding these
|
||||
values now raises a FloatDomainError. This is a regression of the fix in
|
||||
081a3963ea2aab617a92874d7ef59ce98eee6a64.
|
||||
|
||||
Specifying the rounding mode restores the previous behaviour.
|
||||
|
||||
This isn't a problem on master or 6-1-stable, as the rounding mode is
|
||||
always specified there since 7905bdfd8b2ae50319cd7a9a74ee1f8c865d648d.
|
||||
---
|
||||
.../lib/active_support/number_helper/rounding_helper.rb | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/activesupport/lib/active_support/number_helper/rounding_helper.rb b/activesupport/lib/active_support/number_helper/rounding_helper.rb
|
||||
index 2ad8d49c4edb..7f7242f8651a 100644
|
||||
--- a/activesupport/lib/active_support/number_helper/rounding_helper.rb
|
||||
+++ b/activesupport/lib/active_support/number_helper/rounding_helper.rb
|
||||
@@ -26,7 +26,7 @@ def digit_count(number)
|
||||
|
||||
private
|
||||
def round_without_significant(number)
|
||||
- number = number.round(precision)
|
||||
+ number = number.round(precision, BigDecimal.mode(BigDecimal::ROUND_MODE))
|
||||
number = number.to_i if precision == 0 && number.finite?
|
||||
number = number.abs if number.zero? # prevent showing negative zeros
|
||||
number
|
@ -0,0 +1,44 @@
|
||||
From a4d2493b26ff166aa3605684f22e0abb174c0752 Mon Sep 17 00:00:00 2001
|
||||
From: Akira Matsuda <ronnie@dio.jp>
|
||||
Date: Sat, 21 Nov 2020 09:54:43 +0900
|
||||
Subject: [PATCH] Let AS::SafeBuffer#[] and * return value be an instance of
|
||||
SafeBuffer in Ruby 3
|
||||
|
||||
Ruby 3 introduces an incompatibility that String methods return String instances when called on a subclass instance.
|
||||
https://bugs.ruby-lang.org/issues/10845
|
||||
https://github.com/ruby/ruby/pull/3701
|
||||
---
|
||||
.../active_support/core_ext/string/output_safety.rb | 11 ++++++-----
|
||||
1 file changed, 6 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/activesupport/lib/active_support/core_ext/string/output_safety.rb b/activesupport/lib/active_support/core_ext/string/output_safety.rb
|
||||
index 635f9cf45780..60e39d58ca5c 100644
|
||||
--- a/activesupport/lib/active_support/core_ext/string/output_safety.rb
|
||||
+++ b/activesupport/lib/active_support/core_ext/string/output_safety.rb
|
||||
@@ -153,12 +153,12 @@ def initialize
|
||||
|
||||
def [](*args)
|
||||
if html_safe?
|
||||
- new_safe_buffer = super
|
||||
+ new_string = super
|
||||
|
||||
- if new_safe_buffer
|
||||
- new_safe_buffer.instance_variable_set :@html_safe, true
|
||||
- end
|
||||
+ return unless new_string
|
||||
|
||||
+ new_safe_buffer = new_string.is_a?(SafeBuffer) ? new_string : SafeBuffer.new(new_string)
|
||||
+ new_safe_buffer.instance_variable_set :@html_safe, true
|
||||
new_safe_buffer
|
||||
else
|
||||
to_str[*args]
|
||||
@@ -214,7 +214,8 @@ def +(other)
|
||||
end
|
||||
|
||||
def *(*)
|
||||
- new_safe_buffer = super
|
||||
+ new_string = super
|
||||
+ new_safe_buffer = new_string.is_a?(SafeBuffer) ? new_string : SafeBuffer.new(new_string)
|
||||
new_safe_buffer.instance_variable_set(:@html_safe, @html_safe)
|
||||
new_safe_buffer
|
||||
end
|
@ -0,0 +1,33 @@
|
||||
From fdbc55b9d55ae9d2b5b39be3ef4af5f60f6954a3 Mon Sep 17 00:00:00 2001
|
||||
From: Yasuo Honda <yasuo.honda@gmail.com>
|
||||
Date: Mon, 22 Jun 2020 21:19:21 +0900
|
||||
Subject: [PATCH] Use
|
||||
Array(ActiveSupport::ToJsonWithActiveSupportEncoder)#to_json and
|
||||
Hash(ActiveSupport::ToJsonWithActiveSupportEncoder)#to_json for Ruby 2.8.0
|
||||
|
||||
This pull request addresses failures at https://buildkite.com/rails/rails/builds/70219#79d96882-6c51-4854-8cab-28f50ac8bca1
|
||||
According to https://bugs.ruby-lang.org/issues/16973 This is an expected change in Ruby.
|
||||
These failures has been addressed by changing the order of prepend as suggested.
|
||||
|
||||
Refer
|
||||
https://github.com/ruby/ruby/pull/3181
|
||||
https://github.com/ruby/ruby/pull/2936
|
||||
https://bugs.ruby-lang.org/issues/9573
|
||||
https://github.com/rails/rails/pull/19413
|
||||
---
|
||||
activesupport/lib/active_support/core_ext/object/json.rb | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/activesupport/lib/active_support/core_ext/object/json.rb b/activesupport/lib/active_support/core_ext/object/json.rb
|
||||
index d92af19137cd..dcfbe8b40f2a 100644
|
||||
--- a/activesupport/lib/active_support/core_ext/object/json.rb
|
||||
+++ b/activesupport/lib/active_support/core_ext/object/json.rb
|
||||
@@ -45,7 +45,7 @@ def to_json(options = nil)
|
||||
end
|
||||
end
|
||||
|
||||
-[Object, Array, FalseClass, Float, Hash, Integer, NilClass, String, TrueClass, Enumerable].reverse_each do |klass|
|
||||
+[Enumerable, Object, Array, FalseClass, Float, Hash, Integer, NilClass, String, TrueClass].reverse_each do |klass|
|
||||
klass.prepend(ActiveSupport::ToJsonWithActiveSupportEncoder)
|
||||
end
|
||||
|
Loading…
Reference in new issue