Weekly Shaarli

All links of one week in a single page.

Week 12 (March 21, 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