Sha256: 7a9bf19132baa191c0a0862c1b21b15b1f2e3100e839b70ed70f56fef20cf147

Contents?: true

Size: 644 Bytes

Versions: 3

Compression:

Stored size: 644 Bytes

Contents

# frozen_string_literal: true

module Facter
  module Resolvers
    class LoadAverages < BaseResolver
      init_resolver

      class << self
        private

        def post_resolve(fact_name)
          @fact_list.fetch(fact_name) { read_load_averages(fact_name) }
        end

        def read_load_averages(fact_name)
          require 'facter/util/resolvers/ffi/load_averages'

          log.debug('loading cpu load averages')
          @fact_list[:load_averages] = %w[1m 5m 15m].zip(Facter::Util::Resolvers::Ffi::LoadAverages
            .read_load_averages).to_h

          @fact_list[fact_name]
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
facter-4.0.49 lib/facter/resolvers/load_averages.rb
facter-4.0.48 lib/facter/resolvers/load_averages.rb
facter-4.0.47 lib/facter/resolvers/load_averages.rb