Sha256: 08a09da33bcbadfc5073731dde31c80c8f12bc700cc530003d2a9efd7bbc9626
Contents?: true
Size: 763 Bytes
Versions: 7
Compression:
Stored size: 763 Bytes
Contents
# frozen_string_literal: true module Facter # 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 class FactFilter def filter_facts!(searched_facts) filter_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 private def filter_legacy_facts!(resolved_facts) return if Options[:show_legacy] resolved_facts.reject!(&:legacy?) unless Options[:user_query] end end end
Version data entries
7 entries across 7 versions & 1 rubygems