Class: Net::SNMP::Module

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/net/snmp/mib/module.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(struct) ⇒ Module

Returns a new instance of Module.



17
18
19
20
# File 'lib/net/snmp/mib/module.rb', line 17

def initialize(struct)
  raise "Tried to initialize null module" if struct.null?
  @struct = struct
end

Class Method Details

.find(module_id) ⇒ Object

Gets a module node by its id



9
10
11
12
13
14
15
# File 'lib/net/snmp/mib/module.rb', line 9

def self.find(module_id)
  if module_id < 0
    nil
  else
    new(Wrapper.find_module(module_id))
  end
end

Instance Method Details

#fileObject



26
27
28
# File 'lib/net/snmp/mib/module.rb', line 26

def file
  @struct.file.read_string
end

#nameObject



22
23
24
# File 'lib/net/snmp/mib/module.rb', line 22

def name
  @struct.name.read_string
end

#nextObject



30
31
32
33
34
35
36
# File 'lib/net/snmp/mib/module.rb', line 30

def next
  if @struct.next.null?
    nil
  else
    self.class.new(@struct.next)
  end
end