lib/r509/oid_mapper.rb in r509-0.9.2 vs lib/r509/oid_mapper.rb in r509-0.10.0
- old
+ new
@@ -26,7 +26,21 @@
oids.each do |oid_hash|
self.register(oid_hash[:oid],oid_hash[:short_name],oid_hash[:long_name])
end
nil
end
+
+ # Load YAML and register OIDs
+ # @param [String] name Name of the config within the file
+ # @param [String] yaml_data YAML data to load
+ # @example
+ # custom_oids:
+ # - :oid: 1.4.3.2.1.2.3.4.4.4.5
+ # :short_name: testOIDName
+ # - :oid: 1.4.3.2.1.2.5.4.4.4.5
+ # :short_name: anotherOIDName
+ def self.register_from_yaml(name, yaml_data)
+ conf = YAML.load(yaml_data)
+ self.batch_register(conf[name])
+ end
end
end