Skip to content

Commit

Permalink
Merge pull request sunng87#9 from AlexTalker/feat/customhandlebars
Browse files Browse the repository at this point in the history
(feat) Implemented HandlebarsEngine::from() for support construct
  • Loading branch information
sunng87 committed Jun 26, 2015
2 parents 5dc1839 + 9e8037f commit a66da1b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/middleware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,19 @@ impl HandlebarsEngine {
}
}

pub fn new(prefix: &str, suffix: &str) -> HandlebarsEngine {
pub fn from(prefix: &str, suffix: &str, custom: Handlebars) -> HandlebarsEngine {
let eng = HandlebarsEngine {
prefix: prefix.to_string(),
suffix: suffix.to_string(),
registry: RwLock::new(Box::new(Handlebars::new()))
registry: RwLock::new(Box::new(custom))
};
eng.reload();
eng
}

pub fn new(prefix: &str, suffix: &str) -> HandlebarsEngine {
HandlebarsEngine::from(prefix,suffix, Handlebars::new())
}
}

impl AfterMiddleware for HandlebarsEngine {
Expand Down

0 comments on commit a66da1b

Please sign in to comment.