title: How to serialize an array and deserialize back
body: <p>How do I serialize an array and deserialize it back from a string? I tried the following code, but it doesn't really return the original array of integers but does for the array of strings.</p>
  
  <pre><code> x = [1,2,3].join(',') # maybe this is not the correct way to serialize to string?
   =&gt; '1,2,3'
  
   x = x.split(',')
   =&gt; [ '1', '2', '3' ]
  </code></pre>
  
  <p>Is there a way to get it back to integers without having the <code>.collect{ |x| x.to_i }</code>?</p>