class SNMP::Integer
Public Class Methods
decode(value_data)
click to toggle source
# File lib/snmp/varbind.rb, line 80 def self.decode(value_data) Integer.new(decode_integer_value(value_data)) end
new(value)
click to toggle source
# File lib/snmp/varbind.rb, line 88 def initialize(value) @value = value.to_i end
Public Instance Methods
<=>(other)
click to toggle source
# File lib/snmp/varbind.rb, line 92 def <=>(other) return nil unless other.respond_to? :to_i @value <=> other.to_i end
asn1_type()
click to toggle source
# File lib/snmp/varbind.rb, line 84 def asn1_type "INTEGER" end
coerce(other)
click to toggle 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
encode()
click to toggle source
# File lib/snmp/varbind.rb, line 117 def encode encode_integer(@value) end
to_f()
click to toggle source
# File lib/snmp/varbind.rb, line 113 def to_f @value.to_f end
to_i()
click to toggle source
# File lib/snmp/varbind.rb, line 109 def to_i @value end
to_oid()
click to toggle 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
to_s()
click to toggle source
# File lib/snmp/varbind.rb, line 105 def to_s @value.to_s end