Sha256: 6f271e43ec56c794b1677e9a2cf2f7a1281cce629aff1e00360da7b32fe36142

Contents?: true

Size: 470 Bytes

Versions: 12

Compression:

Stored size: 470 Bytes

Contents

# frozen_string_literal: true

module Facter
  module Util
    module Aix
      module InfoExtractor
        MEGABYTES_EXPONENT = 1024**2
        GIGABYTES_EXPONENT = 1024**3

        def self.extract(content, regex)
          content = content.each_line.map do |line|
            next unless regex =~ line

            line.split(/:\s*|\s{2,}/)
          end

          content.flatten!.reject!(&:nil?)

          Hash[*content]
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
facter-4.2.3 lib/facter/util/aix/info_extractor.rb
facter-4.2.2 lib/facter/util/aix/info_extractor.rb
facter-4.2.1 lib/facter/util/aix/info_extractor.rb
facter-4.2.0 lib/facter/util/aix/info_extractor.rb
facter-4.1.1 lib/facter/util/aix/info_extractor.rb
facter-4.1.0 lib/facter/util/aix/info_extractor.rb
facter-4.0.52 lib/facter/util/aix/info_extractor.rb
facter-4.0.51 lib/facter/util/aix/info_extractor.rb
facter-4.0.50 lib/facter/util/aix/info_extractor.rb
facter-4.0.49 lib/facter/util/aix/info_extractor.rb
facter-4.0.48 lib/facter/util/aix/info_extractor.rb
facter-4.0.47 lib/facter/util/aix/info_extractor.rb