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