Ruby API optimization