Replace if block with Enumerable#detect