Module: Ruboty::Ragoon::Template
Constant Summary
Constants included from Config
Instance Method Summary collapse
Methods included from Config
Instance Method Details
#find_template(template_name) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/ruboty/ragoon/template.rb', line 11 def find_template(template_name) ragoon_config(:template_dirs).each do |dirname| template_file = Dir.glob(File.join(dirname, "#{template_name}*")).first return template_file unless template_file.nil? end raise "Template Missing : #{template_name} is not found" end |
#render_template(template_name, variables = {}) ⇒ Object
6 7 8 9 |
# File 'lib/ruboty/ragoon/template.rb', line 6 def render_template(template_name, variables = {}) template = ::Tilt.new(find_template(template_name)) template.render(nil, variables) end |