Sha256: 4214d2e3a226aad793609b9432c8e07f4d78eba55933f12f5319319321280620
Contents?: true
Size: 1.05 KB
Versions: 13
Compression:
Stored size: 1.05 KB
Contents
# frozen_string_literal: true module KPM module SystemProxy class EntropyAvailable attr_reader :entropy_available, :labels def initialize @entropy_available = fetch @labels = [{ label: :entropy }, { label: :value }] end private def fetch entropy_available = nil if OS.windows? entropy_available = fetch_windows elsif OS.linux? entropy_available = fetch_linux elsif OS.mac? entropy_available = fetch_mac end entropy_available end def fetch_linux entropy_available_data = `cat /proc/sys/kernel/random/entropy_avail 2>&1`.gsub("\n", '') build_hash(entropy_available_data) end def fetch_mac build_hash('-') end def fetch_windows build_hash('-') end def build_hash(data) entropy_available = {} entropy_available['entropy_available'] = { entropy: 'available', value: data } entropy_available end end end end
Version data entries
13 entries across 13 versions & 1 rubygems