Module: Flatrack::Template
- Defined in:
- lib/flatrack/template.rb,
lib/flatrack/template/rb.rb,
lib/flatrack/template/html.rb,
lib/flatrack/template/erubis.rb,
lib/flatrack/template/erubis/handler.rb
Defined Under Namespace
Classes: Erubis, Html, Rb
Class Method Summary
collapse
Class Method Details
.find(type, file) ⇒ Object
8
9
10
11
12
13
14
|
# File 'lib/flatrack/template.rb', line 8
def find(type, file)
template = find_by_type type, file
fail FileNotFound, "could not find #{file}" unless template
Tilt.new template, options
rescue RuntimeError
raise(TemplateNotFound, "could not find a renderer for #{file}")
end
|
.find_by_type(type, file) ⇒ Object
25
26
27
28
29
30
31
|
# File 'lib/flatrack/template.rb', line 25
def find_by_type(type, file)
if File.exist?(file)
file
else
Dir[File.join type.to_s.pluralize, "#{file}*"].first
end
end
|
.options ⇒ Object
18
19
20
21
22
23
|
# File 'lib/flatrack/template.rb', line 18
def options
local_options = {}
super.merge local_options
rescue NoMethodError
local_options
end
|