Top Level Namespace

Defined Under Namespace

Modules: Enums, FFI, Facter, Facts, HardwareFFI, IdentityFFI, KernelFFI, LegacyFacter, MemoryFFI, NetworkingFFI, Sys, System32FFI Classes: AdapterAddressAligmentUnion, AdapterAddressStruct, CliLauncher, DummyStructName, DummyUnionName, IpAdapterAddressesLh, IpAdapterUnicastAddressLH, IpAdapterUnicastAddressXPUnion, IpAdapterUnicastAddressXPUnionStruct, LoggerHelper, NetworkUtils, OsDetector, OsVersionInfoEx, PerformanceInformation, SockAddr, SocketAddress, SystemInfo

Constant Summary collapse

PATH_TO_SCHEMA =
File.join(File.dirname(__FILE__), '../schema/facter.yaml')
PATH_TO_TEMPLATE =
File.join(File.dirname(__FILE__), 'template.erb')
ERROR_MORE_DATA =
234
MAX_PATH =
32_767
MAX_ADAPTER_ADDRESS_LENGTH =
8
MAX_DHCPV6_DUID_LENGTH =
130

Instance Method Summary collapse

Instance Method Details

#format_facts(fact_hash) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
# 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) ⇒ Object



13
14
15
16
17
18
19
# 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