class RspecPuppetFactsUnsupported::Facts
Private class
Attributes
facts[R]
Public Class Methods
new(facts)
click to toggle source
# File lib/rspec-puppet-facts-unsupported/on_unsupported_os.rb, line 192 def initialize(facts) @facts = facts end
Public Instance Methods
[](key)
click to toggle source
# File lib/rspec-puppet-facts-unsupported/on_unsupported_os.rb, line 197 def [](key) normalized_key = factkey(key) facts_by_path(facts, normalized_key) end
Private Instance Methods
facter_current?()
click to toggle source
# File lib/rspec-puppet-facts-unsupported/on_unsupported_os.rb, line 214 def facter_current? facterversion >= '3.0.0' end
facterversion()
click to toggle source
# File lib/rspec-puppet-facts-unsupported/on_unsupported_os.rb, line 218 def facterversion facts[:facterversion] end
factkey(fact)
click to toggle source
# File lib/rspec-puppet-facts-unsupported/on_unsupported_os.rb, line 204 def factkey(fact) era = facter_current? ? :current : :legancy factname(fact, era: era) end
facts_by_path(facts, path)
click to toggle source
# File lib/rspec-puppet-facts-unsupported/on_unsupported_os.rb, line 209 def facts_by_path(facts, path) stringified = Hash[facts.map { |k, v| [k.to_s, v] }] path.to_s.split('.').inject(stringified) { |hash, key| hash[key] } end