Sha256: 8857cb84e57f7c2365ff3d671c0f95d51845008c9bf073011d7ed96f51132197

Contents?: true

Size: 513 Bytes

Versions: 2

Compression:

Stored size: 513 Bytes

Contents

# frozen_string_literal: true

module Facter
  module El
    class Kernelmajversion
      FACT_NAME = 'kernelmajversion'

      def call_the_resolver
        fact_value = Resolvers::Uname.resolve(:kernelrelease)
        ResolvedFact.new(FACT_NAME, major_version(fact_value))
      end

      private

      def major_version(fact_value)
        value_split = fact_value.split('.')
        return value_split[0] if value_split.length <= 1

        value_split[0] + '.' + value_split[1]
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
facter-4.0.8.pre lib/facts/el/kernelmajversion.rb
facter-4.0.7.pre lib/facts/el/kernelmajversion.rb