BinStruct provides a simple way to create and dissect binary data. It is an extraction from PacketGen 3.x Fields.
Installation using RubyGems is easy:
$ gem install bin_struct
Or add it to a Gemfile:
gem 'bin_struct'
The gem is available as open source under the terms of the MIT License.