Class Dnsruby::Bitmap
In: lib/dnsruby/bitmap.rb
Parent: Object

Instances of this class can be created that will hold on to bitmap data and be used to test bits and convert to other formats.

Where an array is used to represent bits, the first element (0) will be the high bit and the last element will be the low (1‘s column) bit.

Methods

Attributes

number  [R]  This is the internal representation of the bitmap value:

Public Class methods

Creates an instance from a binary string (e.g. "\x0C").

Creates an instance from a bit array (e.g. [1, 0, 0, 1])

Creates an instance from a nonnegative number.

Creates an instance from a value array (e.g. [8, 0, 0, 1])

Creates an instance from an array of positions for the bits that are set (e.g. [0, 3])

Public Instance methods

Set a new value to number, validating first that it is nonnegative.

Returns the instance‘s value as a binary string (e.g. "\x0C")

Returns the instance‘s value as an array of bit column place values (e.g. [8, 0, 0, 1])

Returns the instance‘s value as an array of bit column values (e.g. [8, 0, 0, 1])

Returns the instance‘s value as an array of positions for the bits that are set (e.g. [0, 3])

[Validate]