Could you move this to a constant? ie: BatchTypes = ['COUNTER', ...] BatchTypes.include?(type)