class SidekiqUniqueJobs::Script::Template
@author Mikael Henriksson <mikael@mhenrixon.com>
Class Template provides LUA script partial template rendering
def include_partial(relative_path)
helper method to include a lua partial within another lua script
def include_partial(relative_path) return if @partial_templates.key?(relative_path) @partial_templates[relative_path] = nil render(Pathname.new("#{@script_path}/#{relative_path}")) end
def initialize(script_path)
def initialize(script_path) @script_path = script_path end
def render(pathname)
-
(String)
- the rendered Luascript
Parameters:
-
pathname
(Pathname
) -- the path to the
def render(pathname) @partial_templates ||= {} ::ERB.new(File.read(pathname)).result(binding) end