If you find yourself dealing with explicit data from binary files in ruby, you may end up writing something like this.
pack
and unpack
work great, and have a wealth of ways to get at the data String#unpack rdoc. But after using nice DSLs like ActiveRecord and DataMapper, we can do better!
BinData has patterns for cleanly describing how to access the data structures found in binary files. Data can be nested inside other types, including ones you define yourself.
I’m using it to read a Minecraft map file and manipulate shapes with ruby. Here are some of the highlights of what BinData can do!
Go check it out over at Rubyforge