title: How Does Ruby handle bytes/binary?
body: <p>I'm trying to send a series of binary bytes across a socket, to meet a particular standard my company uses. No one in my company has used Ruby for this before, but in other languages, they send the data across one byte at a time, (usually with some sort of "pack" method). </p>
  
  <p>I can't find anyway to create binary on the fly, or create bytes at all (the closest I can find it how you can turn a string into the bytes representing it's characters).  </p>
  
  <p>I know you can say something like :</p>
  
  <p>@var = 0b101010101</p>
  
  <p>But how would I convert a string in the form "101010101" or the resulting integer created when I do string.to_i(2) into an actual binary. If I just send the string accross a socket, won't that just send the ASCII for "0" and "1" instead of the literal characters?  </p>
  
  <p>Surely there is SOME way to do this natively in Ruby?</p>