Method: Dnsruby::RR::NXT::NxtTypes.assert_legal_bitmap_value

Defined in:
lib/dnsruby/resource/NXT.rb

Assert that the specified number is a legal value with which to instantiate a NXT type bitmap. Raise on error, do nothing on success.



238
239
240
241
242
243
244
245
246
# File 'lib/dnsruby/resource/NXT.rb', line 238

def assert_legal_bitmap_value(number)
  max_value = NxtTypes::MAX_BITMAP_NUMBER_VALUE
  if number > max_value
    raise ArgumentError.new("Bitmap maximum value is #{max_value} (0x#{max_value.to_s(16)}).")
  end
  if number & 1 == 1
    raise ArgumentError.new("Bitmap number must not have low bit set.")
  end
end