Class: Dnsruby::Bitmap

### Home Classes Methods

### In Files

- lib/dnsruby/bitmap.rb

### Parent

Object

### Methods

- ::from_binary_string
- ::from_bit_array
- ::from_number
- ::from_place_value_array
- ::from_set_bit_position_array
- ::new
- #==
- #number=
- #to_binary_string
- #to_bit_array
- #to_place_value_array
- #to_set_bit_position_array

### Files

- DNSSEC
- EVENTMACHINE
- EXAMPLES

### Class/Module Index

Quicksearch

- Dnsruby
- Dnsruby::Algorithms
- Dnsruby::BitMapping
- Dnsruby::Bitmap
- Dnsruby::Classes
- Dnsruby::CodeMapper
- Dnsruby::Config
- Dnsruby::DNS
- Dnsruby::DecodeError
- Dnsruby::Dnssec
- Dnsruby::Dnssec::ValidationPolicy
- Dnsruby::EncodeError
- Dnsruby::ExtendedRCode
- Dnsruby::FormErr
- Dnsruby::Header
- Dnsruby::Hosts
- Dnsruby::IPv4
- Dnsruby::IPv6
- Dnsruby::Message
- Dnsruby::Message::SecurityLevel
- Dnsruby::MetaTypes
- Dnsruby::Modes
- Dnsruby::NXDomain
- Dnsruby::NXRRSet
- Dnsruby::Name
- Dnsruby::Name::Label
- Dnsruby::NotAuth
- Dnsruby::NotImp
- Dnsruby::NotZone
- Dnsruby::Nsec3HashAlgorithms
- Dnsruby::OpCode
- Dnsruby::OtherResolvError
- Dnsruby::QTypes
- Dnsruby::Question
- Dnsruby::RCode
- Dnsruby::RR
- Dnsruby::RR::ANY
- Dnsruby::RR::CERT
- Dnsruby::RR::CERT::CertificateTypes
- Dnsruby::RR::CNAME
- Dnsruby::RR::DHCID
- Dnsruby::RR::DLV
- Dnsruby::RR::DNAME
- Dnsruby::RR::DNSKEY
- Dnsruby::RR::DS
- Dnsruby::RR::DS::DigestTypes
- Dnsruby::RR::DomainName
- Dnsruby::RR::GPOS
- Dnsruby::RR::Generic
- Dnsruby::RR::HINFO
- Dnsruby::RR::HIP
- Dnsruby::RR::IN
- Dnsruby::RR::IN::A
- Dnsruby::RR::IN::AAAA
- Dnsruby::RR::IN::AFSDB
- Dnsruby::RR::IN::PX
- Dnsruby::RR::IN::SRV
- Dnsruby::RR::IN::WKS
- Dnsruby::RR::IPSECKEY
- Dnsruby::RR::ISDN
- Dnsruby::RR::KX
- Dnsruby::RR::LOC
- Dnsruby::RR::MB
- Dnsruby::RR::MG
- Dnsruby::RR::MINFO
- Dnsruby::RR::MR
- Dnsruby::RR::MX
- Dnsruby::RR::NAPTR
- Dnsruby::RR::NS
- Dnsruby::RR::NSAP
- Dnsruby::RR::NSEC
- Dnsruby::RR::NSEC3
- Dnsruby::RR::NSEC3PARAM
- Dnsruby::RR::NXT
- Dnsruby::RR::NXT::NxtTypes
- Dnsruby::RR::NXT::TypeBitmap
- Dnsruby::RR::OPT
- Dnsruby::RR::PTR
- Dnsruby::RR::RP
- Dnsruby::RR::RRSIG
- Dnsruby::RR::RT
- Dnsruby::RR::SOA
- Dnsruby::RR::SPF
- Dnsruby::RR::SSHFP
- Dnsruby::RR::SSHFP::Algorithms
- Dnsruby::RR::SSHFP::FpTypes
- Dnsruby::RR::TKEY
- Dnsruby::RR::TSIG
- Dnsruby::RR::TXT
- Dnsruby::RR::X25
- Dnsruby::RRSet
- Dnsruby::Recursor
- Dnsruby::Refused
- Dnsruby::Resolv
- Dnsruby::ResolvError
- Dnsruby::ResolvTimeout
- Dnsruby::Resolver
- Dnsruby::Resolver::EventType
- Dnsruby::Section
- Dnsruby::SelectThread
- Dnsruby::ServFail
- Dnsruby::SingleResolver
- Dnsruby::SocketEofResolvError
- Dnsruby::TheLog
- Dnsruby::TsigError
- Dnsruby::TsigNotSignedResponseError
- Dnsruby::Types
- Dnsruby::Update
- Dnsruby::VerifyError
- Dnsruby::YXDomain
- Dnsruby::YXRRSet
- Dnsruby::ZoneReader
- Dnsruby::ZoneReader::ParseException
- Dnsruby::ZoneSerialError
- Dnsruby::ZoneTransfer
- Dnsruby::ZoneTransfer::Delta
- Base32
- Object

No matching classes.

# Dnsruby::Bitmap

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.

### Attributes

number[R]

This is the internal representation of the bitmap value:

### Public Class Methods

from_binary_string(string) click to toggle source

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

    # File lib/dnsruby/bitmap.rb, line 58
    def self.from_binary_string(string)
      new(BitMapping.binary_string_to_number(string))
    end

from_bit_array(array) click to toggle source

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

    # File lib/dnsruby/bitmap.rb, line 68
    def self.from_bit_array(array)
      new(BitMapping.bit_array_to_number(array))
    end

from_number(number) click to toggle source

Creates an instance from a nonnegative number.

    # File lib/dnsruby/bitmap.rb, line 53
    def self.from_number(number)
      new(number)
    end

from_place_value_array(array) click to toggle source

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

    # File lib/dnsruby/bitmap.rb, line 63
    def self.from_place_value_array(array)
      new(BitMapping.place_value_array_to_number(array))
    end

from_set_bit_position_array(array) click to toggle source

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

    # File lib/dnsruby/bitmap.rb, line 73
    def self.from_set_bit_position_array(array)
      new(BitMapping.set_bit_position_array_to_number(array))
    end

new(number) click to toggle source

    # File lib/dnsruby/bitmap.rb, line 99
    def initialize(number)
      BitMapping.assert_non_negative(number)
      @number = number
    end

### Public Instance Methods

==(other) click to toggle source

    # File lib/dnsruby/bitmap.rb, line 104
    def ==(other)
      other.is_a?(self.class) && other.number == self.number
    end

number=(new_number) click to toggle source

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

    # File lib/dnsruby/bitmap.rb, line 34
    def number=(new_number)
      self.assert_non_negative(new_number)
      @number = new_number
    end

to_binary_string(min_length = 0) click to toggle source

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

    # File lib/dnsruby/bitmap.rb, line 80
    def to_binary_string(min_length = 0)
      BitMapping.number_to_binary_string(number, min_length)
    end

to_bit_array() click to toggle source

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

    # File lib/dnsruby/bitmap.rb, line 90
    def to_bit_array
      BitMapping.number_to_bit_array(number)
    end

to_place_value_array() click to toggle source

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

    # File lib/dnsruby/bitmap.rb, line 85
    def to_place_value_array
      BitMapping.number_to_place_value_array(number)
    end

to_set_bit_position_array() click to toggle source

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

    # File lib/dnsruby/bitmap.rb, line 95
    def to_set_bit_position_array
      BitMapping.number_to_set_bit_positions_array(number)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.