Ruby script for batch processing