Class: SNMP::UnsignedInteger

Inherits:
Integer
  • Object
show all
Defined in:
lib/snmp/varbind.rb

Direct Known Subclasses

Counter32, Gauge32, TimeTicks, Unsigned32

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Integer

#<=>, #asn1_type, #coerce, #encode, #to_f, #to_i, #to_oid, #to_s

Methods included from BER::Decode

#assert_no_remainder, #build_integer, #decode_integer, #decode_integer_value, #decode_ip_address, #decode_object_id, #decode_object_id_value, #decode_octet_string, #decode_sequence, #decode_timeticks, #decode_tlv, #decode_uinteger_value

Methods included from BER::Encode

#encode_exception, #encode_integer, #encode_length, #encode_null, #encode_object_id, #encode_octet_string, #encode_sequence, #encode_tagged_integer, #encode_tlv, #integer_to_octets

Constructor Details

#initialize(value) ⇒ UnsignedInteger

Returns a new instance of UnsignedInteger.

Raises:

  • (ArgumentError)

360
361
362
363
364
# File 'lib/snmp/varbind.rb', line 360

def initialize(value)
  super(value)
  raise ArgumentError, "Negative integer invalid: #{@value}" if @value < 0
  raise ArgumentError, "Out of range: #{@value}" if @value > 4294967295
end

Class Method Details

.decode(value_data) ⇒ Object


366
367
368
# File 'lib/snmp/varbind.rb', line 366

def self.decode(value_data)
  self.new(decode_uinteger_value(value_data))
end