lib/docs/generate.rb in facter-4.6.1 vs lib/docs/generate.rb in facter-4.7.0

- old
+ new

@@ -15,10 +15,15 @@ def format_facts(fact_hash) scope = OpenStruct.new({ facts: fact_hash }) - erb = ERB.new(File.read(PATH_TO_TEMPLATE), trim_mode: '-') + + erb = if ERB.instance_method(:initialize).parameters.assoc(:key) # Ruby 2.6+ + ERB.new(File.read(PATH_TO_TEMPLATE), trim_mode: '-') + else + ERB.new(File.read(PATH_TO_TEMPLATE), nil, '-') + end erb.result(scope.instance_eval { binding }) end print "## Modern Facts\n\n" print format_facts(schema.reject { |_name, info| info['hidden'] == true })