class P::Template
Attributes
directory[R]
name[R]
path[R]
template[R]
Public Class Methods
new(template, name)
click to toggle source
# File lib/p/template.rb, line 7 def initialize(template, name) @template = template @path = find_template(template) @directory = File.join(File.dirname(@path), template) @name = name end
Public Instance Methods
variables()
click to toggle source
# File lib/p/template.rb, line 14 def variables { name: name } end
Private Instance Methods
find_template(t)
click to toggle source
# File lib/p/template.rb, line 20 def find_template(t) P.template_paths.each do |base| path = File.join(base, t + ".rb") return path if File.exists?(path) end raise(TemplateNotFound, "Could not find template `#{t}` in: #{P.template_paths.inspect}") end