Class: Facter::FormatterHelper
- Inherits:
-
Object
- Object
- Facter::FormatterHelper
- Defined in:
- lib/facter/framework/formatters/formatter_helper.rb
Class Method Summary collapse
- .retrieve_fact_collection(resolved_facts) ⇒ Object
- .retrieve_fact_value_for_single_query(user_query, resolved_facts) ⇒ Object
- .retrieve_facts_to_display_for_user_query(user_queries, resolved_facts) ⇒ Object
Class Method Details
.retrieve_fact_collection(resolved_facts) ⇒ Object
18 19 20 21 |
# File 'lib/facter/framework/formatters/formatter_helper.rb', line 18 def retrieve_fact_collection(resolved_facts) fact_collection = FactCollection.new.build_fact_collection!(resolved_facts) Facter::Utils.sort_hash_by_key(fact_collection) end |
.retrieve_fact_value_for_single_query(user_query, resolved_facts) ⇒ Object
23 24 25 26 27 |
# File 'lib/facter/framework/formatters/formatter_helper.rb', line 23 def retrieve_fact_value_for_single_query(user_query, resolved_facts) fact_collection = build_fact_collection_for_user_query(user_query, resolved_facts) fact_collection = Utils.sort_hash_by_key(fact_collection) fact_collection.dig_fact(user_query) end |
.retrieve_facts_to_display_for_user_query(user_queries, resolved_facts) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/facter/framework/formatters/formatter_helper.rb', line 6 def retrieve_facts_to_display_for_user_query(user_queries, resolved_facts) facts_to_display = FactCollection.new user_queries.each do |user_query| fact_collection = build_fact_collection_for_user_query(user_query, resolved_facts) printable_value = fact_collection.dig_fact(user_query) facts_to_display.merge!(user_query => printable_value) end Facter::Utils.sort_hash_by_key(facts_to_display) end |