BAEL-2981: Changed helper name
This commit is contained in:
parent
e9410f8fda
commit
ca3ef57f04
|
@ -23,7 +23,7 @@ public class CustomHelperUnitTest {
|
||||||
@Test
|
@Test
|
||||||
public void whenHelperIsCreated_ThenCanRegister() throws IOException {
|
public void whenHelperIsCreated_ThenCanRegister() throws IOException {
|
||||||
Handlebars handlebars = new Handlebars(templateLoader);
|
Handlebars handlebars = new Handlebars(templateLoader);
|
||||||
handlebars.registerHelper("person", new Helper<Person>() {
|
handlebars.registerHelper("isBusy", new Helper<Person>() {
|
||||||
@Override
|
@Override
|
||||||
public Object apply(Person context, Options options) throws IOException {
|
public Object apply(Person context, Options options) throws IOException {
|
||||||
String busyString = context.isBusy() ? "busy" : "available";
|
String busyString = context.isBusy() ? "busy" : "available";
|
||||||
|
|
|
@ -2,7 +2,7 @@ package com.baeldung.handlebars;
|
||||||
|
|
||||||
public class HelperSource {
|
public class HelperSource {
|
||||||
|
|
||||||
public String person(Person context) {
|
public String isBusy(Person context) {
|
||||||
String busyString = context.isBusy() ? "busy" : "available";
|
String busyString = context.isBusy() ? "busy" : "available";
|
||||||
return context.getName() + " - " + busyString;
|
return context.getName() + " - " + busyString;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{{#person this}}{{/person}}
|
{{#isBusy this}}{{/isBusy}}
|
Loading…
Reference in New Issue