1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #34899 from rails/speed-up-step

Duration#coerce should always return a Scalar
This commit is contained in:
Aaron Patterson 2019-01-09 09:28:00 -08:00 committed by GitHub
commit 28bb21bf5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -214,8 +214,11 @@ module ActiveSupport
end end
def coerce(other) #:nodoc: def coerce(other) #:nodoc:
if Scalar === other case other
when Scalar
[other, self] [other, self]
when Duration
[Scalar.new(other.value), self]
else else
[Scalar.new(other), self] [Scalar.new(other), self]
end end