BitPacker
bit-packer provides easy declarative way of analyzing the packed bit arrays. See an example:
require "bit-packer"
bp = BitPacker::new(7) do
number (:alfa) {2} # length of the entry in bits in block
boolean :beta
end
p bp.data
# will print out #<struct alfa=3, beta=true>
You can both read from data struct and write to it:
bp.data.boolean = false
bp.data.number = 2
p bp.to_i
# will print out 4
Contributing
- Fork it.
- Create a branch (
git checkout -b 20101220-my-change
). - Commit your changes (
git commit -am "Added something"
). - Push to the branch (
git push origin 20101220-my-change
). - Create an Issue with a link to your branch.
- Enjoy a refreshing Diet Coke and wait.
Copyright
Copyright © 2011 Martin Kozák. See LICENSE.txt
for
further details.