Class: Snp::Path
- Inherits:
-
Object
- Object
- Snp::Path
- Defined in:
- lib/snp/path.rb
Overview
Instance Method Summary collapse
-
#absolute_paths ⇒ Object
Public: returns the list of absolute paths to the directories in which the templates should be looked.
-
#which(template, extension) ⇒ Object
Public: resolves a template file by looking in the template path.
Instance Method Details
#absolute_paths ⇒ Object
Public: returns the list of absolute paths to the directories in which the templates should be looked.
13 14 15 |
# File 'lib/snp/path.rb', line 13 def absolute_paths dir_list.map { |d| File.(d) } end |
#which(template, extension) ⇒ Object
Public: resolves a template file by looking in the template path.
template - the template name. extension - the extension of the desired template.
Returns a string with the full path of the template file, or nil if it is not found.
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/snp/path.rb', line 24 def which(template, extension) template_with_extension = with_extension(template, extension) path = absolute_paths.find do |path| File.exists?(File.join(path, template_with_extension)) end if path File.join(path, template_with_extension) end end |