class ActiveSupport::Duration

def iso8601(precision: nil)

The +precision+ parameter can be used to limit seconds' precision of duration.
Build ISO 8601 Duration string for this duration.
def iso8601(precision: nil)
  ISO8601Serializer.new(self, precision: precision).serialize
end