Ruby script for data conversion