+(other)
public
Show source
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)
else
seconds = @parts.fetch(:seconds, 0) + other
Duration.new(value + other, @parts.merge(seconds: seconds))
end
end