Daily Shaarli

All links of one day in a single page.

March 23, 2022

Memo: How to test erb templates with ruby (puppet)
thumbnail

test.erb

<% if condition %>TRUE<% else %>FALSE<% end %>

test.rb

require 'erb'

condition = true                                                                                                                                                                                                

template = ERB.new File.read("test.erb"), nil, "%" 
puts template.result(binding)

Then, run ruby test.rb

Can also be very useful: Puppet Debugger