Allow access to unset rtattrs to return nil

This commit is contained in:
Brian Candler
2011-04-29 15:42:16 +01:00
parent f16c819743
commit 6b74827fc3

View File

@@ -164,7 +164,7 @@ module Netlink
info = TYPE_INFO[type] info = TYPE_INFO[type]
self::RTATTRS[code] = [name, info] self::RTATTRS[code] = [name, info]
define_method name do define_method name do
@attrs.fetch name @attrs[name] # rtattrs are optional, non-existent returns nil
end end
define_method "#{name}=" do |val| define_method "#{name}=" do |val|
@attrs.store name, val @attrs.store name, val