Sha256: 074cedba9de21330563016b2c32dd8fe376ec78ef6acb3216d8c224c9ba5569d

Contents?: true

Size: 386 Bytes

Versions: 11

Compression:

Stored size: 386 Bytes

Contents

# frozen_string_literal: true

module Facter
  class YamlFactFormatter
    def initialize
      @log = Log.new(self)
    end

    def format(fact_hash)
      yaml_pretty = YAML.dump(JSON.parse(JsonFactFormatter.new.format(fact_hash)))

      @log.debug('Replace ---  from yaml beginning, to keep it compatible with C facter')
      yaml_pretty.gsub(/^---[\r\n]+/, '')
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
facter-4.0.17 lib/framework/formatters/yaml_fact_formatter.rb
facter-4.0.16 lib/framework/formatters/yaml_fact_formatter.rb
facter-4.0.15 lib/framework/formatters/yaml_fact_formatter.rb
facter-4.0.14 lib/framework/formatters/yaml_fact_formatter.rb
facter-4.0.13 lib/framework/formatters/yaml_fact_formatter.rb
facter-4.0.12 lib/framework/formatters/yaml_fact_formatter.rb
facter-4.0.11 lib/framework/formatters/yaml_fact_formatter.rb
facter-4.0.10.pre lib/framework/formatters/yaml_fact_formatter.rb
facter-4.0.9.pre lib/framework/formatters/yaml_fact_formatter.rb
facter-4.0.8.pre lib/framework/formatters/yaml_fact_formatter.rb
facter-4.0.7.pre lib/framework/formatters/yaml_fact_formatter.rb