extract code into ruby file