Daniel Martin wrote:
...
> > In any case, Ruby Facets has a BinaryReader mixin
> > (http://facets.rubyforge.org/api/more/classes/BinaryReader.html) that
> > does the reading and upacking for you. Just mix it into File (or a
> > subclass of File) and you should be good to go...
>
> That's fine if you want to pull out each field in succession yourself,
> but BitStruct provides much more than that, by providing a DSL for
> packed-bit structures.  Also, if you see my reply, you'll notice that
> he was in fact very close to getting what he wanted.
>
> Actually, going through this exercise has pointed up some features
> that I would like to add to BitStruct, since in many cases it almost
> but not quite completely was exactly what the poster wanted.  It would
> be nice to have an easy, obvious, and supported way to define extra
> padding in a structure (as we needed to here).  It would be nice to
> have an easier, supported syntax for reading a structure from a binary
> file.  Finally, it would be nice to allow an easy way to define data
> wrappers, as was done with the date property.

My ref to BinaryReader wasn't a slight against BitStruct, I haven't
used either
so can't comment.  Just found it and figured I'd throw it into the mix.

Just occurred to me that combining BitStruct with BinaryReader and
maybe StringIO could produce a nice BinaryIO class/module?

BTW, I noticed that all the fields in the BitStruct had endianess
specified.
Is there a way to set the endianess for the whole structure?  Would you

have a strucutre with mixed endianess? 

Nice work
Chris