Refactor a complex method of Padrino::Filter