Class: Facter::HoconFactFormatter
- Inherits:
-
Object
- Object
- Facter::HoconFactFormatter
- Defined in:
- lib/facter/framework/formatters/hocon_fact_formatter.rb
Instance Method Summary collapse
- #format(resolved_facts) ⇒ Object
-
#initialize ⇒ HoconFactFormatter
constructor
A new instance of HoconFactFormatter.
Constructor Details
#initialize ⇒ HoconFactFormatter
Returns a new instance of HoconFactFormatter.
5 6 7 |
# File 'lib/facter/framework/formatters/hocon_fact_formatter.rb', line 5 def initialize @log = Log.new(self) end |
Instance Method Details
#format(resolved_facts) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/facter/framework/formatters/hocon_fact_formatter.rb', line 9 def format(resolved_facts) user_queries = resolved_facts.uniq(&:user_query).map(&:user_query) return if user_queries.count < 1 return format_for_multiple_user_queries(user_queries, resolved_facts) if user_queries.count > 1 user_query = user_queries.first return format_for_no_query(resolved_facts) if user_query.empty? format_for_single_user_query(user_queries.first, resolved_facts) unless user_query.empty? end |