instance method
+
Ruby on Rails 7.2.3
Since v2.2.3Signature
+(other)
Adds another Duration or a Numeric to this Duration. Numeric values are treated as seconds.
Parameters
-
otherreq
Source
# File activesupport/lib/active_support/duration.rb, line 268
def +(other)
if Duration === other
parts = @parts.merge(other._parts) do |_key, value, other_value|
value + other_value
end
Duration.new(value + other.value, parts, @variable || other.variable?)
else
seconds = @parts.fetch(:seconds, 0) + other
Duration.new(value + other, @parts.merge(seconds: seconds), @variable)
end
end
Defined in activesupport/lib/active_support/duration.rb line 268
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::Duration