We've had rats nesting in our compost boxes over the years, even when we owned a cat, or cats. The moggies would chase the rats away if I disturbed the nest, but they didn't go seeking a fight. Warm laps and regular meals of tinned food were far preferable.
At the time I read that the smell of cats' urine was a rat-deterrent, so I took to adding a bit of pee-soaked cat litter to the heap, and around the edge of the compost boxes. Seemed to work, but I can't honestly be sure. More recently, in the absence of cats, I have been regularly stirring the heaps using a probe with harpoon-like hinged barbs, which mixes the compost nicely as you withdraw the probe. No sign of rats, but regular stirring is easier to keep up in the summer when the rats are less likely to take up residence. A warm, dry compost heap composed of vegetable waste provides attractive lodging in the winter - at a time when this fair-weather gardener might also prefer to stay in the warm and dry rather than go poking around at the bottom of the garden. Incidentally, I also wonder whether the human urine I use as an accelerant might also deter the rodents!