Skip to content

Commit

Permalink
template() is now object().
Browse files Browse the repository at this point in the history
  • Loading branch information
brett-smith committed Mar 12, 2024
1 parent 2c6fcec commit d120f22
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public class Example1 {
condition("friday", () -> day.equals("Fri"))
).toList()
)).
template("me", content -> Template.ofContent(content).
object("me", content -> Template.ofContent(content).
variable("name", "Joe B").
variable("age", 44).
variable("location", "London"))
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/sshtools/tinytemplate/Templates.java
Original file line number Diff line number Diff line change
Expand Up @@ -510,11 +510,11 @@ public TemplateModel include(String key, Supplier<TemplateModel> model) {
return this;
}

public TemplateModel template(String key, TemplateModel template) {
return template(key, (content) -> template);
public TemplateModel object(String key, TemplateModel template) {
return object(key, (content) -> template);
}

public TemplateModel template(String key, Function<String, TemplateModel> template) {
public TemplateModel object(String key, Function<String, TemplateModel> template) {
templates.put(key, template);
return this;
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/sshtools/tinytemplate/TemplatesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,7 @@ public void testTemplateObject() {
</body>
</html>
""").
template("aPerson", (c) ->
object("aPerson", (c) ->
TemplateModel.ofContent(c).
variable("name", "Joe B").
variable("age", "27").
Expand Down

0 comments on commit d120f22

Please sign in to comment.