BitStruct for Complete applications Publisher's description
from Joel VanderWerf
This Ruby class contains packed binary data stored using Ruby strings
Its main use is in defining network protocol packets used for network protocols (IP).
For .gem: Run the command gem install bit-struct
For .tgz, unpack and run these commands:
ruby install.rb config
ruby install.rb setup
ruby install.rb install
Here are some key features of "BitStruct":
В· Extensible with user-defined field classes.
В· Fields are fully introspectable and can be defined programmatically.
В· BitStruct.describe prints out documentation of all the fields of a BitStruct subclass, based on declarations. This is useful for communicating with developers who are not using ruby, but need to talk the same protocols.
В· Fields are inherited by subclasses.
В· BitStruct#inspect and BitStruct#inspect_detailed can be used for prettified display of contents.
В· BitStruct inherits from String, so all the usual methods are available, and string-sharing (copy-on-write) is in effect.
В· Easy access to a "prototype" instance of each BitStruct subclass, from which all instances of that subclass are initialized as a copy (in the absence of other initialization parameters, such as a hash, a string, or a block). See BitStruct.initial_value, and BitStruct#initialize.
В· Easy conversion to and from hashes, using BitStruct#to_h and BitStruct.new.
В· BitStructs can persist using Marshal (a BitStruct is after all just a string) or using YAML (with human readable representation of the fields).
В· Includes tests, examples, and rdoc API documentation.
В· Fields that are not aligned on byte boundaries may cross no more than two bytes boundaries.
В· No variable length fields (except the rest field).
What's New in This Release:В· Packaged as a gem using bones.
В· Added nest fields defined with blocks.
В· Vector length may be specified as argument or :length option.
Program Release Status: Major Update
Program Install Support: Install Only