class Object

Constants

ERROR_MORE_DATA
MAX_ADAPTER_ADDRESS_LENGTH
MAX_DHCPV6_DUID_LENGTH
MAX_PATH
PATH_TO_SCHEMA
PATH_TO_TEMPLATE

Public Instance Methods

format_facts(fact_hash) click to toggle source
# File lib/docs/generate.rb, line 16
def format_facts(fact_hash)
  scope = OpenStruct.new({
                           facts: fact_hash
                         })

  erb = if ERB.instance_method(:initialize).parameters.assoc(:key) # Ruby 2.6+
          ERB.new(File.read(PATH_TO_TEMPLATE), trim_mode: '-')
        else
          ERB.new(File.read(PATH_TO_TEMPLATE), nil, '-')
        end
  erb.result(scope.instance_eval { binding })
end
load_dir(*dirs) click to toggle source
# File lib/facter/framework/core/file_loader.rb, line 13
def load_dir(*dirs)
  folder_path = File.join(@lib_path, dirs)
  return unless Dir.exist?(folder_path.tr('*', ''))

  files_to_require = Dir.glob(File.join(folder_path, '*.rb')).reject { |file| file =~ %r{/ffi/} }
  files_to_require.each(&method(:require))
end