Simpler logic to category patch

Replace single line with cleaner, more readable Ruby.