Mixes in a fluent interface to any IO entity for reading and writing binary data. It handles (de)serialization of:
- Integer numbers
- Null terminated strings
- Fixed size strings
Binary Finery assumes that the stream where is mixed in, provides the following methods:
- read or read_nonblock - write or write_nonblock
It will run under Ruby version 1.8.7 or newer.
File.open(my_file.bin) do |f| f.extend(BinaryFinery) version = f.read_uint16_big length = f.read_uint32_little end
$ gem install binary_finery
If you'd like to hack on, please follow these instructions. To get all of the dependencies, install the gem first.
- Fork the project and clone down your fork
- Create a branch with a descriptive name to contain your change
- Hack away
- Add tests and make sure everything still passes by running rake
- Do not change the version number, I will do that on my end
- If necessary, rebase your commits into logical chunks, without errors
- Push the branch up to GitHub
- Send me (altamic) a pull request for your branch
© Copyright 2011 Michelangelo Altamore. See LICENSE for details.