Bill Atkins wrote: > Rather than having code like this: > > flags, ignore, length, name = data.unpack "nnna*" > > let's try this: > > u = Unpacker.new data > flags, ignore, length, name = u.word, u.word, u.word, u.string > > I think this looks a lot neater and is much more maintainable. A > similar thing could be done with pack. > > p = Packer.new > p.word 0x01 > p.word 0x00 > p.word 0x08 > p.string "ERERER" > > p.to_s => packed version > > Any ideas on this before I draft it up into a real RCR? > > Bill Atkins > > . > I'm for it. I actually wrote up a couple of utility classes to (more or less) do just this for me, for the Net::SSH stuff. Dealing directly with pack/unpack makes my head hurt after a while. -- Jamis Buck jgb3 / email.byu.edu http://www.jamisbuck.org/jamis ruby -h | ruby -e 'a=[];readlines.join.scan(/-(.)\[e|Kk(\S*)|le.l(..)e|#!(\S*)/) {|r| a << r.compact.first };puts "\n>#{a.join(%q/ /)}<\n\n"'