Skip to content

Commit

Permalink
Add register back in
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-fowler committed Jan 30, 2024
1 parent 316a5eb commit c9d5021
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Sources/HummingbirdMustache/Library.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ public struct HBMustacheLibrary: Sendable {
self.templates = try Self.loadTemplates(from: directory, withExtension: `extension`)
}

/// Register template under name
/// - Parameters:
/// - mustache: Mustache text
/// - name: Name of template
public mutating func register(_ mustache: String, named name: String) throws {
let template = try HBMustacheTemplate(string: mustache)
self.templates[name] = template
}

/// Return template registed with name
/// - Parameter name: name to search for
/// - Returns: Template
Expand Down

0 comments on commit c9d5021

Please sign in to comment.