title: How to convert to big endian in ruby
body: <p>I have a string in little-endian order, as a hexadecimal-encoded string</p>
  
  <pre><code>000000020597ba1f0cd423b2a3abb0259a54ee5f783077a4ad45fb6200000218
  000000008348d1339e6797e2b15e9a3f2fb7da08768e99f02727e4227e02903e
  43a42b31511553101a051f3c0000000000000080000000000000000000000000
  0000000000000000000000000000000000000000000000000000000080020000
  </code></pre>
  
  <p>I'd like to byteswap each 32-bit chunk from little-endian to big-endian resulting to </p>
  
  <pre><code>020000001fba9705b223d40c25b0aba35fee549aa477307862fb45ad18020000
  0000000033d14883e297679e3f9a5eb108dab72ff0998e7622e427273e90027e
  312ba443105315513c1f051a0000000080000000000000000000000000000000
  0000000000000000000000000000000000000000000000000000000000000280
  </code></pre>
  
  <p>I've tried several approaches but haven't goten it to work. It'd be great if someone can show a sample implementation.</p>
  
  <p>Cheers.</p>