class ActiveMocker::TemplateCreator
Attributes
binding[R]
erb_template[R]
file_out[R]
post_process[R]
Public Class Methods
new(erb_template:, file_out: nil, binding:, post_process: -> (str) { str }
click to toggle source
# File lib/active_mocker/template_creator.rb, line 6 def initialize(erb_template:, file_out: nil, binding:, post_process: -> (str) { str }) @erb_template = erb_template @binding = binding @file_out = file_out || Tempfile.new("TemplateModel") @post_process = post_process end
Public Instance Methods
render()
click to toggle source
# File lib/active_mocker/template_creator.rb, line 13 def render template = ERB.new(erb_template.read, nil, ">") file_out.write post_process.call(template.result(binding)) file_out end