Sha256: d30a38abc97a2254958138e679b6c03783bba670dcefe8ca97aa40c099aa8d9a

Contents?: true

Size: 598 Bytes

Versions: 1

Compression:

Stored size: 598 Bytes

Contents

class Snmpjr
  class Response
    attr_reader :error, :oid, :type

    def initialize response = {}
      @error = response[:error] || ''
      @value = response[:value] || ''
      @oid = response[:oid] || ''
      @type = response[:type] || ''
    end

    def error?
      if @error.empty?
        false
      else
        true
      end
    end

    def to_h
      { oid: @oid, value: @value, type: @type }
    end

    def to_s
      @value
    end

    def ==(other)
      return false unless other.instance_of?(self.class)
      @error == other.error && to_h == other.to_h
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
snmpjr-0.3.3-java lib/snmpjr/response.rb