Module: Fields

Defined in:
lib/fields.rb

Overview

If you add new Field subclasses, you need to name them with a capitalized ‘Field’ at the end, eg CrazyField, and use it in Binstruct by declaring the first half in lower case. Like this: module Fields class CrazyField < StringField # I act just like a StringField, only crunchy! end end

class MyStruct < Binstruct crazy :field_name, 32, “A Crazy Field!”

Take a look at the documentation for Fields::Field for some other guidlines on creating new Field subclasses that can’t trivially inherit one of the base classes like Fields::StringField or Fields::HexstringField.

Defined Under Namespace

Classes: BitstringField, Field, HexstringField, OctetstringField, SignedField, StringField, UnsignedField

Constant Summary collapse

Field_Subtypes =

BitstringField

self.constants.map {|const| const.to_s.sub(/Field/,'').downcase.to_sym if const=~/^.+Field/}.compact