How to Format text in a template?
I use puppet together with foreman. I have a module that sets the /etc/motd file. It generates the content of that file from a template.
The template contains, amongst other things this:
<%= @comment %>
The "comment" variable comes from Foreman, and can contain anything from a few words to several lines of text. I want format this text in some way, fix it to for example 40 columns, with proper word wrap.
I know that there exist several "pretty print" functions on ruby. I've tried this:
<% pp( @comment, width = 40) %>
But this threw an error.
Error: Could not retrieve ...