Top Level Namespace

Defined Under Namespace

Modules: Enums, FFI, Facter, Facts, HardwareFFI, IdentityFFI, KernelFFI, LegacyFacter, MemoryFFI, NetworkingFFI, System32FFI, WinnlsFFI 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