Sha256: 8be70ba04a3d5c322f2eead1e25c3c121aa32b8f99cc1fb7ec4c9948472d31c4

Contents?: true

Size: 379 Bytes

Versions: 15

Compression:

Stored size: 379 Bytes

Contents

# frozen_string_literal: true

module Facter
  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

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
facter-4.0.46 lib/facter/resolvers/aix/utils/info_extractor.rb
facter-4.0.44 lib/facter/resolvers/aix/utils/info_extractor.rb
facter-4.0.43 lib/facter/resolvers/aix/utils/info_extractor.rb
facter-4.0.42 lib/facter/resolvers/aix/utils/info_extractor.rb
facter-4.0.41 lib/facter/resolvers/aix/utils/info_extractor.rb
facter-4.0.40 lib/facter/resolvers/aix/utils/info_extractor.rb
facter-4.0.39 lib/facter/resolvers/aix/utils/info_extractor.rb
facter-4.0.38 lib/facter/resolvers/aix/utils/info_extractor.rb
facter-4.0.37 lib/facter/resolvers/aix/utils/info_extractor.rb
facter-4.0.36 lib/facter/resolvers/aix/utils/info_extractor.rb
facter-4.0.35 lib/facter/resolvers/aix/utils/info_extractor.rb
facter-4.0.34 lib/facter/resolvers/aix/utils/info_extractor.rb
facter-4.0.33 lib/facter/resolvers/aix/utils/info_extractor.rb
facter-4.0.32 lib/facter/resolvers/aix/utils/info_extractor.rb
facter-4.0.31 lib/facter/resolvers/aix/utils/info_extractor.rb