Sha256: b320818921e1719853ed3bbb35558cebc41492869292bf010d6555f0835eb78e

Contents?: true

Size: 489 Bytes

Versions: 2

Compression:

Stored size: 489 Bytes

Contents

# frozen_string_literal: true

module Facter
  class ClassDiscoverer
    include Singleton

    def initialize
      @log = Log.new(self)
    end

    def discover_classes(operating_system)
      os_module_name = Module.const_get("Facter::#{operating_system}")

      # select only classes
      os_module_name.constants.select { |c| os_module_name.const_get(c).is_a? Class }
    rescue NameError
      @log.error("There is no module named #{operating_system}")
      []
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
facter-4.0.8.pre lib/framework/core/fact_loaders/class_discoverer.rb
facter-4.0.7.pre lib/framework/core/fact_loaders/class_discoverer.rb