class Snmp2mkr::ConfigTypes::Root

Attributes

api_key[R]
hosts[R]
mib_load_path[R]
mib_modules[R]
mib_no_default_modules[R]
persist_file[R]
templates[R]

Public Instance Methods

collect_children() click to toggle source
# File lib/snmp2mkr/config_types/root.rb, line 26
def collect_children
  [
    @hosts,
    @templates,
    @persist_file,
    @api_key,
  ].compact
end
setup(hash) click to toggle source
# File lib/snmp2mkr/config_types/root.rb, line 10
def setup(hash)
  raise TypeError, "#{self.class} must be given a Hash" unless hash.kind_of?(Hash)

  @mib_no_default_modules = hash.fetch('mib_no_default_modules', false)

  @mib_load_path = hash.fetch('mib_load_path', [])
  raise TypeError, "mib_load_path should be an Array" unless @mib_load_path.kind_of?(Array)
  @mib_modules = hash.fetch('mib_load_path', [])
  raise TypeError, "mib_modules should be an Array" unless @mib_modules.kind_of?(Array)

  @hosts = HostCollection.new(hash.fetch('hosts'))
  @templates = TemplateCollection.new(hash.fetch('templates'))
  @persist_file = EnvString.new(hash.fetch('persist_file'))
  @api_key = EnvString.new(hash.fetch('api_key'))
end