module Net::BER::Extensions::Array

def to_ber_oid

++
proper SNMP OID object.
this appears to be SNMP-specific. This should probably be subsumed by a
20100320 AZ: I do not think that this method should be in BER, since
--
SNMP Object Identifiers (OID) are special arrays
#
def to_ber_oid
  ary = self.dup
  first = ary.shift
  raise Net::BER::BerError, "Invalid OID" unless [0, 1, 2].include?(first)
  first = first * 40 + ary.shift
  ary.unshift first
  oid = ary.pack("w*")
  [6, oid.length].pack("CC") + oid
end