class SNMP::Integer
Public Class Methods
Source
# File lib/snmp/varbind.rb, line 80 def self.decode(value_data) Integer.new(decode_integer_value(value_data)) end
Source
# File lib/snmp/varbind.rb, line 88 def initialize(value) @value = value.to_i end
Public Instance Methods
Source
# File lib/snmp/varbind.rb, line 92 def <=>(other) return nil unless other.respond_to? :to_i @value <=> other.to_i end
Source
# File lib/snmp/varbind.rb, line 97 def coerce(other) if other.kind_of? ::Integer return [other, @value] else return [other.to_f, self.to_f] end end
Source
# File lib/snmp/varbind.rb, line 121 def to_oid raise RangeError, "@{value} cannot be an OID (must be >0)" if @value < 0 ObjectId.new([@value]) end