Skip to content

Commit

Permalink
Allow numerics for templates using code_maybe_block
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
seanmil committed Jan 19, 2024
1 parent 6891e66 commit 083865a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/puppet-strings/markdown/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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}`"
Expand Down

0 comments on commit 083865a

Please sign in to comment.