Class: SNMP::Integer

### Home Classes Methods

### In Files

- lib/snmp/varbind.rb

### Parent

Object

### Methods

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

### Included Modules

- Comparable

### Files

- README.rdoc

### Class/Module Index

Quicksearch

- SNMP
- SNMP::BER
- SNMP::Counter32
- SNMP::Counter64
- SNMP::EndOfMibView
- SNMP::Gauge32
- SNMP::GetBulkRequest
- SNMP::GetNextRequest
- SNMP::GetRequest
- SNMP::InformRequest
- SNMP::Integer
- SNMP::Integer32
- SNMP::InvalidErrorStatus
- SNMP::InvalidGenericTrap
- SNMP::InvalidIpAddress
- SNMP::InvalidPduTag
- SNMP::InvalidTrapVarbind
- SNMP::IpAddress
- SNMP::MIB
- SNMP::MIB::ModuleNotLoadedError
- SNMP::Manager
- SNMP::Manager::Config
- SNMP::Message
- SNMP::NoSuchInstance
- SNMP::NoSuchObject
- SNMP::Null
- SNMP::ObjectId
- SNMP::ObjectName
- SNMP::OctetString
- SNMP::Opaque
- SNMP::PDU
- SNMP::ParseError
- SNMP::RequestId
- SNMP::RequestTimeout
- SNMP::Response
- SNMP::SNMPv1_Trap
- SNMP::SNMPv2_Trap
- SNMP::SetRequest
- SNMP::TimeTicks
- SNMP::TrapListener
- SNMP::TrapListener::Config
- SNMP::UDPServerTransport
- SNMP::UDPTransport
- SNMP::Unsigned32
- SNMP::UnsignedInteger
- SNMP::UnsupportedPduTag
- SNMP::UnsupportedValueTag
- SNMP::UnsupportedVersion
- SNMP::VarBind
- SNMP::VarBindList
- Fixnum
- Object

No matching classes.

# SNMP::Integer

### Public Class Methods

decode(value_data) click to toggle source

    # File lib/snmp/varbind.rb, line 63
    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 71
    def initialize(value)
      @value = value.to_i
    end

### Public Instance Methods

<=>(other) click to toggle source

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

asn1_type() click to toggle source

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

coerce(other) click to toggle 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

encode() click to toggle source

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

to_f() click to toggle source

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

to_i() click to toggle source

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

to_oid() click to toggle 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

to_s() click to toggle source

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

[Validate]

Generated with the Darkfish Rdoc Generator 2.