This module is intended to be used to extend class objects. It provides the method
bit_field for declaring a bit field.
Public Instance Methods
Creates a bit field for managing the integer attribute
mapping argument specifies the mapping of names to zero-based bit indices which allows one to use either the bit name or its index when getting or setting. When using an unknown bit name or bit index, an error is raised.
The calling class needs to respond to #name and #name= because these methods are used to get and set the raw integer value; or provide custom method names using the
After invoking the method the calling class has four new instance methods:
NAME_values which returns an array of bit names representing the set bits.
NAME_include?(bit) which returns true if the given bit is set.
set_NAME(*bits, clear_existing: false) for setting the given bits.
unset_NAME(*bits) for clearing the given bits.
The method names can be overridden using the arguments