Method: YARD::Templates::Engine.template
- Defined in:
- lib/yard/templates/engine.rb
.template(*path) ⇒ Template
Creates a template module representing the path. Searches on disk for the first directory named path
(joined by ‘/’) within the template paths and builds a template module for. All other matching directories in other template paths will be included in the generated module as mixins (for overriding).
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/yard/templates/engine.rb', line 35 def template(*path) from_template = nil from_template = path.shift if path.first.is_a?(Template) path = path.join('/') full_paths = find_template_paths(from_template, path) path = File.cleanpath(path).gsub('../', '') raise ArgumentError, "No such template for #{path}" if full_paths.empty? mod = template!(path, full_paths) mod end |