module NETSNMP::OID

Abstracts the OID structure

Constants

OIDREGEX

Public Instance Methods

build(id) click to toggle source
# File lib/netsnmp/oid.rb, line 13
def build(id)
  oid = MIB.oid(id)
  oid = oid[1..-1] if oid.start_with?(".")
  oid
end
parent?(parent_oid, child_oid) click to toggle source

@param [OID, String] child oid another oid @return [true, false] whether the given OID belongs to the sub-tree

# File lib/netsnmp/oid.rb, line 26
def parent?(parent_oid, child_oid)
  child_oid.match?(/\A#{parent_oid}\./)
end
to_asn(oid) click to toggle source
# File lib/netsnmp/oid.rb, line 19
def to_asn(oid)
  OpenSSL::ASN1::ObjectId.new(oid)
end