Ruby Equivalent to Python's Struct
Is there a Ruby equivalent to the pack and/or unpack methods of Python's struct module?
Yes, it is a method of the Array class, so you get in on any array instance by default.
a = [65, 66, 67]
b = a.pack("ccc")
Similarly, the unpack() method is part of the String class, so you'll get it by default on any string instance.
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne
"I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
Awesome. Thank you very much, Scorpions.