Class: Facter::FactFilter

Inherits:
Object
  • Object
show all
Defined in:
lib/facter/framework/core/fact_filter.rb

Overview

Filter inside value of a fact. e.g. os.release.major is the user query, os.release is the fact and major is the filter criteria inside tha fact

Instance Method Summary collapse

Instance Method Details

#filter_facts!(searched_facts) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/facter/framework/core/fact_filter.rb', line 8

def filter_facts!(searched_facts)
  filter_legacy_facts!(searched_facts)
  filter_blocked_legacy_facts!(searched_facts)

  searched_facts.each do |fact|
    fact.value = if fact.filter_tokens.any? && fact.value.respond_to?(:dig)
                   fact.value.dig(*fact.filter_tokens)
                 else
                   fact.value
                 end
  end
end