Module: NETSNMP::OID
- Defined in:
- lib/netsnmp/oid.rb
Overview
Abstracts the OID structure
Constant Summary collapse
- OIDREGEX =
/^[\d\.]*$/
Class Method Summary collapse
- .build(id) ⇒ Object
-
.parent?(parent_oid, child_oid) ⇒ true, false
Whether the given OID belongs to the sub-tree.
- .to_asn(oid) ⇒ Object
Class Method Details
.build(id) ⇒ Object
13 14 15 16 17 |
# 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) ⇒ true, false
Returns whether the given OID belongs to the sub-tree.
26 27 28 |
# File 'lib/netsnmp/oid.rb', line 26 def parent?(parent_oid, child_oid) child_oid.match?(/\A#{parent_oid}\./) end |
.to_asn(oid) ⇒ Object
19 20 21 |
# File 'lib/netsnmp/oid.rb', line 19 def to_asn(oid) OpenSSL::ASN1::ObjectId.new(oid) end |