Sha256: bbe1a8dac6094c8b1720f95dd3acf73bcdf53469425303d80712de0a54e361b3

Contents?: true

Size: 630 Bytes

Versions: 13

Compression:

Stored size: 630 Bytes

Contents

# frozen_string_literal: true

module Facter
  module Resolvers
    module Bsd
      class LoadAverages < BaseResolver
        @semaphore = Mutex.new
        @fact_list ||= {}
        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_relative 'ffi/ffi_helper'
            @fact_list[:load_averages] = %w[1m 5m 15m].zip(Facter::Bsd::FfiHelper.read_load_averages).to_h

            @fact_list[fact_name]
          end
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
facter-4.0.33 lib/facter/resolvers/bsd/load_averages_resolver.rb
facter-4.0.32 lib/facter/resolvers/bsd/load_averages_resolver.rb
facter-4.0.31 lib/facter/resolvers/bsd/load_averages_resolver.rb
facter-4.0.30 lib/facter/resolvers/bsd/load_averages_resolver.rb
facter-4.0.29 lib/resolvers/bsd/load_averages_resolver.rb
facter-4.0.28 lib/resolvers/bsd/load_averages_resolver.rb
facter-4.0.26 lib/resolvers/bsd/load_averages_resolver.rb
facter-4.0.25 lib/resolvers/bsd/load_averages_resolver.rb
facter-4.0.24 lib/resolvers/bsd/load_averages_resolver.rb
facter-4.0.23 lib/resolvers/bsd/load_averages_resolver.rb
facter-4.0.22 lib/resolvers/bsd/load_averages_resolver.rb
facter-4.0.21 lib/resolvers/bsd/load_averages_resolver.rb
facter-4.0.20 lib/resolvers/bsd/load_averages_resolver.rb