Module: Precious::Views::TemplateCascade
- Included in:
- Layout
- Defined in:
- lib/gollum/views/template_cascade.rb
Instance Method Summary collapse
- #first_path_available(name) ⇒ Object
-
#template_file ⇒ Object
Method should track lib/mustache/settings.rb from Mustache project.
- #template_priority_path ⇒ Object
- #template_priority_path=(path) ⇒ Object
Instance Method Details
#first_path_available(name) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/gollum/views/template_cascade.rb', line 13 def first_path_available(name) default = File.join(template_path, "#{name}.#{template_extension}") priority = if template_priority_path File.join(template_priority_path, "#{name}.#{template_extension}") end priority && File.exist?(priority) ? priority : default end |
#template_file ⇒ Object
Method should track lib/mustache/settings.rb from Mustache project.
24 25 26 |
# File 'lib/gollum/views/template_cascade.rb', line 24 def template_file @template_file || first_path_available(template_name) end |
#template_priority_path ⇒ Object
4 5 6 |
# File 'lib/gollum/views/template_cascade.rb', line 4 def template_priority_path @@template_priority_path ||= nil end |
#template_priority_path=(path) ⇒ Object
8 9 10 11 |
# File 'lib/gollum/views/template_cascade.rb', line 8 def template_priority_path=(path) @@template_priority_path = File.(path) @template = nil end |