hallidave/ruby-snmp — pull request #25 by hiro-su (2013-07-30 06:56:46+00:00)
Title: Fixed the error message when a list of ObjectId or VarBind Objects is nil

When Varbind Object is nil, an error message is unclear as follows.

$ irb
irb(main):001:0> require 'snmp'
irb(main):002:0> manager = SNMP::Manager.new(:Host => 'localhost', :Port => 161)
irb(main):003:0> manager.get(nil)
NoMethodError: undefined method `each' for nil:NilClass
from /usr/local/Cellar/ruby/1.9.3-p327/lib/ruby/gems/1.9.1/gems/snmp-1.1.1/lib/snmp/mib.rb:180:in `varbind_list'
from /usr/local/Cellar/ruby/1.9.3-p327/lib/ruby/gems/1.9.1/gems/snmp-1.1.1/lib/snmp/manager.rb:230:in `get'

So, I fixed error messages as follows.

irb(main):003:0> manager.get(nil)
ArgumentError: A list of ObjectId or VarBind objects is NilClass
from /usr/local/Cellar/ruby/1.9.3-p327/lib/ruby/gems/1.9.1/gems/snmp-1.1.1/lib/snmp/mib.rb:173:in `varbind_list'
from /usr/local/Cellar/ruby/1.9.3-p327/lib/ruby/gems/1.9.1/gems/snmp-1.1.1/lib/snmp/manager.rb:230:in `get'