| Class | SNMP::IpAddress |
| In: |
lib/snmp/varbind.rb
|
| Parent: | Object |
Create an IpAddress object. The constructor accepts either a raw four-octet string or a formatted string of integers separated by dots (i.e. "10.1.2.3").
# File lib/snmp/varbind.rb, line 246 def initialize(value_data) ip = value_data.to_str if ip.length > 4 ip = parse_string(ip) elsif ip.length != 4 raise InvalidIpAddress, "Expected 4 octets or formatted string, got #{value_data.inspect}" end @value = ip end
# File lib/snmp/varbind.rb, line 278 def ==(other) if other.respond_to? :to_str return @value.eql?(other.to_str) else return false end end
# File lib/snmp/varbind.rb, line 272 def to_oid oid = ObjectId.new @value.each_byte { |b| oid << b } oid end