Module: SNMP

Defined in:
lib/snmp/open.rb,
lib/snmp/open/parser.rb,
lib/snmp/open/options.rb,
lib/snmp/open/version.rb,
lib/snmp/open/file_reader.rb,
lib/snmp/open/command_reader.rb,
lib/snmp/open/parser/constants.rb,
lib/snmp/open/parser/value_parser.rb

Overview

Simple Network Management Protocol

Defined Under Namespace

Classes: Open

Class Method Summary collapse

Class Method Details

.convert_from_snmp_to_ruby(value) ⇒ Object

Converts types introduced by the snmp gem to native ruby types



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/snmp/open.rb', line 7

module_function def convert_from_snmp_to_ruby(value)
  return nil if [NoSuchInstance, NoSuchObject, Null].include?(value)

  case value
  when Integer
    value.to_i
  when IpAddress, String
    value.to_s
  else
    value
  end
end