From 083865a2bb9bd2f5270e4ad2824696219ae5e744 Mon Sep 17 00:00:00 2001 From: Sean Millichamp Date: Fri, 19 Jan 2024 11:53:23 -0500 Subject: [PATCH] Allow numerics for templates using code_maybe_block A number of ERB templates use the code_maybe_block method to assist with formatting. This fails if the value being passed is not a string, such as an integer default value for a resource type. --- lib/puppet-strings/markdown/helpers.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet-strings/markdown/helpers.rb b/lib/puppet-strings/markdown/helpers.rb index 90a29b322..40885e734 100644 --- a/lib/puppet-strings/markdown/helpers.rb +++ b/lib/puppet-strings/markdown/helpers.rb @@ -12,7 +12,7 @@ module PuppetStrings::Markdown::Helpers # @param [String] inline_prefix String to insert before if it’s inline. # @returns [String] Markdown def code_maybe_block(code, type: :puppet, block_prefix: "\n\n", inline_prefix: ' ') - if code.include?("\n") + if code.to_s.include?("\n") "#{block_prefix}```#{type}\n#{code}\n```" else "#{inline_prefix}`#{code}`"