Class: Facts::Macosx::Os::Macosx::Version

Inherits:
Object
  • Object
show all
Defined in:
lib/facter/facts/macosx/os/macosx/version.rb

Constant Summary collapse

FACT_NAME =
'os.macosx.version'
ALIASES =
%w[macosx_productversion macosx_productversion_major macosx_productversion_minor].freeze

Instance Method Summary collapse

Instance Method Details

#call_the_resolverObject



11
12
13
14
15
16
17
18
19
20
# File 'lib/facter/facts/macosx/os/macosx/version.rb', line 11

def call_the_resolver
  fact_value = Facter::Resolvers::SwVers.resolve(:productversion)
  versions = fact_value.split('.')
  ver = { 'full' => fact_value, 'major' => "#{versions[0]}.#{versions[1]}", 'minor' => versions[-1] }

  [Facter::ResolvedFact.new(FACT_NAME, ver),
   Facter::ResolvedFact.new(ALIASES[0], fact_value, :legacy),
   Facter::ResolvedFact.new(ALIASES[1], ver['major'], :legacy),
   Facter::ResolvedFact.new(ALIASES[2], ver['minor'], :legacy)]
end