Class SNMP::Integer
In: lib/snmp/varbind.rb
Parent: Object

Methods

<=>   asn1_type   coerce   decode   encode   new   to_f   to_i   to_oid   to_s  

Included Modules

Comparable

Public Class methods

[Source]

# File lib/snmp/varbind.rb, line 63
    def self.decode(value_data)
        Integer.new(decode_integer_value(value_data))
    end

[Source]

# File lib/snmp/varbind.rb, line 71
    def initialize(value)
        @value = value.to_i
    end

Public Instance methods

[Source]

# File lib/snmp/varbind.rb, line 75
    def <=>(other)
        @value <=> other.to_i
    end

[Source]

# File lib/snmp/varbind.rb, line 67
    def asn1_type
        "INTEGER"
    end

[Source]

# File lib/snmp/varbind.rb, line 79
    def coerce(other)
        if other.kind_of? Fixnum
            return [other, @value]
        else
            return [other.to_f, self.to_f]
        end
    end

[Source]

# File lib/snmp/varbind.rb, line 99
    def encode
        encode_integer(@value)
    end

[Source]

# File lib/snmp/varbind.rb, line 95
    def to_f
        @value.to_f
    end

[Source]

# File lib/snmp/varbind.rb, line 91
    def to_i
        @value
    end

[Source]

# File lib/snmp/varbind.rb, line 103
    def to_oid
        raise RangeError, "@{value} cannot be an OID (must be >0)" if @value < 0
        ObjectId.new([@value])
    end

[Source]

# File lib/snmp/varbind.rb, line 87
    def to_s
        @value.to_s
    end

[Validate]