Created
July 10, 2019 20:17
-
-
Save nmenag/2c896f57ad63dd28eccdfc09b88a67d4 to your computer and use it in GitHub Desktop.
using template with ERB class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template = ERB.new(@template) | |
template.def_method(LayoutRenderer, 'render') | |
result = LayoutRenderer.new.render do | |
ERB.new(@content).result(binding) | |
end | |
File.open('tmp/payslip_filename.html', 'w+') do |f| | |
f.write result | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment