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:
commit
28bb21bf5a
1 changed files with 4 additions and 1 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue