refactor(loader): Rename TemplateLoader to Loader
This commit is contained in:
@@ -19,7 +19,7 @@ class IncludeNode : NodeType {
|
||||
}
|
||||
|
||||
func render(_ context: Context) throws -> String {
|
||||
guard let loader = context["loader"] as? TemplateLoader else {
|
||||
guard let loader = context["loader"] as? Loader else {
|
||||
throw TemplateSyntaxError("Template loader not in context")
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ class ExtendsNode : NodeType {
|
||||
}
|
||||
|
||||
func render(_ context: Context) throws -> String {
|
||||
guard let loader = context["loader"] as? TemplateLoader else {
|
||||
guard let loader = context["loader"] as? Loader else {
|
||||
throw TemplateSyntaxError("Template loader not in context")
|
||||
}
|
||||
|
||||
|
||||
@@ -2,13 +2,13 @@ import Foundation
|
||||
import PathKit
|
||||
|
||||
|
||||
public protocol TemplateLoader {
|
||||
public protocol Loader {
|
||||
func loadTemplate(name: String) throws -> Template?
|
||||
func loadTemplate(names: [String]) throws -> Template?
|
||||
}
|
||||
|
||||
|
||||
extension TemplateLoader {
|
||||
extension Loader {
|
||||
func loadTemplate(names: [String]) throws -> Template? {
|
||||
for name in names {
|
||||
let template = try loadTemplate(name: name)
|
||||
@@ -24,7 +24,7 @@ extension TemplateLoader {
|
||||
|
||||
|
||||
// A class for loading a template from disk
|
||||
public class FileSystemLoader: TemplateLoader {
|
||||
public class FileSystemLoader: Loader {
|
||||
public let paths: [Path]
|
||||
|
||||
public init(paths: [Path]) {
|
||||
|
||||
Reference in New Issue
Block a user