Sha256: 756dfa0f99898b5f0c4f75d84872d2b2ac4b2d76d0feae22b8f6bca5f54f07ad
Contents?: true
Size: 672 Bytes
Versions: 12
Compression:
Stored size: 672 Bytes
Contents
# frozen_string_literal: true module Facter module FilesystemHelper MOUNT_KEYS = %i[device filesystem path options available available_bytes size size_bytes used used_bytes capacity].freeze def self.read_mountpoints require 'sys/filesystem' Sys::Filesystem.mounts end def self.read_mountpoint_stats(path) require 'sys/filesystem' Sys::Filesystem.stat(path) end def self.compute_capacity(used, total) if used == total '100%' elsif used.positive? "#{format('%.2f', 100.0 * used.to_f / total.to_f)}%" else '0%' end end end end
Version data entries
12 entries across 12 versions & 1 rubygems