Class | AMQP::BitSet
In: | lib/amqp/bit_set.rb
Parent: | Object

Very minimalistic, pure Ruby implementation of bit set. Inspired by java.util.BitSet, although significantly smaller in scope.

### Methods

[] clear get init_words new set unset word_index

### Constants

ADDRESS_BITS_PER_WORD | = | 6 |  | API
BITS_PER_WORD | = | (1 << ADDRESS_BITS_PER_WORD)
WORD_MASK | = | 0xffffffffffffffff

### Public Class methods

new(nbits)

@param [Integer] Number of bits in the set @api public

### Public Instance methods

[](i)

Alias for get

clear()

Clears all bits in the set @api public

get(i)

Fetches flag value for given bit.

@param [Integer] A bit to fetch @return [Boolean] true if given bit is set, false otherwise @api public

set(i)

Sets (flags) given bit. This method allows bits to be set more than once in a row, no exception will be raised.

@param [Integer] A bit to set @api public

unset(i)

Unsets (unflags) given bit. This method allows bits to be unset more than once in a row, no exception will be raised.

@param [Integer] A bit to unset @api public

### Protected Instance methods

init_words(nbits)

@private

word_index(i)

@private

[Validate]