Class: Facter::FactManager
- Inherits:
-
Object
- Object
- Facter::FactManager
- Includes:
- Singleton
- Defined in:
- lib/facter/framework/core/fact_manager.rb
Overview
Instance Method Summary collapse
-
#initialize ⇒ FactManager
constructor
A new instance of FactManager.
- #resolve_core(user_query = []) ⇒ Object
- #resolve_facts(user_query = []) ⇒ Object
- #searched_facts(user_query = []) ⇒ Object
Constructor Details
#initialize ⇒ FactManager
Returns a new instance of FactManager.
7 8 9 10 11 12 |
# File 'lib/facter/framework/core/fact_manager.rb', line 7 def initialize @internal_fact_mgr = InternalFactManager.new @external_fact_mgr = ExternalFactManager.new @fact_loader = FactLoader.instance @log = Log.new(self) end |
Instance Method Details
#resolve_core(user_query = []) ⇒ Object
38 39 40 41 42 43 44 45 46 |
# File 'lib/facter/framework/core/fact_manager.rb', line 38 def resolve_core(user_query = []) loaded_facts_hash = @fact_loader.internal_facts searched_facts = QueryParser.parse(user_query, loaded_facts_hash) resolved_facts = @internal_fact_mgr.resolve_facts(searched_facts) FactFilter.new.filter_facts!(resolved_facts) resolved_facts end |
#resolve_facts(user_query = []) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/facter/framework/core/fact_manager.rb', line 19 def resolve_facts(user_query = []) searched_facts = parse_user_query(user_query) cache_manager = Facter::CacheManager.new searched_facts, cached_facts = cache_manager.resolve_facts(searched_facts) internal_facts = @internal_fact_mgr.resolve_facts(searched_facts) external_facts = @external_fact_mgr.resolve_facts(searched_facts) resolved_facts = override_core_facts(internal_facts, external_facts) resolved_facts = resolved_facts.concat(cached_facts) cache_manager.cache_facts(resolved_facts) FactFilter.new.filter_facts!(resolved_facts) log_resolved_facts(resolved_facts) resolved_facts end |
#searched_facts(user_query = []) ⇒ Object
14 15 16 17 |
# File 'lib/facter/framework/core/fact_manager.rb', line 14 def searched_facts(user_query = []) loaded_facts = @fact_loader.load(Options.get) QueryParser.parse(user_query, loaded_facts) end |