Skip to content

Commit

Permalink
better method name for prev commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ptrthomas committed Mar 25, 2021
1 parent 80434d4 commit 33067c7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions karate-core/src/main/java/com/intuit/karate/graal/JsEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -171,15 +171,15 @@ public JsValue execute(Value function, Object... args) {
return new JsValue(result);
}

public Value evalLocal(boolean returnValue, String src, Value value) {
return evalLocal(returnValue, src, value.getMemberKeys(), value::getMember);
public Value evalWith(boolean returnValue, String src, Value value) {
return evalWith(returnValue, src, value.getMemberKeys(), value::getMember);
}

public Value evalLocal(boolean returnValue, String src, Map<String, Object> variables) {
return evalLocal(returnValue, src, variables.keySet(), variables::get);
public Value evalWith(boolean returnValue, String src, Map<String, Object> variables) {
return evalWith(returnValue, src, variables.keySet(), variables::get);
}

public Value evalLocal(boolean returnValue, String src, Set<String> names, Function<String, Object> getVariable) {
public Value evalWith(boolean returnValue, String src, Set<String> names, Function<String, Object> getVariable) {
StringBuilder sb = new StringBuilder();
sb.append("(function(x){ ");
Map<String, Object> arg = new HashMap(names.size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public Object eval(String source) {

public Object evalWith(String source, Object o) {
Value value = Value.asValue(o);
return RequestCycle.get().getEngine().evalLocal(true, source, value);
return RequestCycle.get().getEngine().evalWith(true, source, value);
}

public String toJson(Object o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public JsValue evalGlobal(String src) {
}

public JsValue evalLocal(String src, boolean returnValue) {
Value value = jsEngine.evalLocal(returnValue, src, getVariableNames(), this::getVariable);
Value value = jsEngine.evalWith(returnValue, src, getVariableNames(), this::getVariable);
return new JsValue(value);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ void testEvalLocal() {
Map<String, Object> map = new HashMap();
map.put("a", 1);
map.put("b", 2);
Value result = je.evalLocal(true, "a + b", map);
Value result = je.evalWith(true, "a + b", map);
assertEquals(result.asInt(), 3);
}

Expand Down

0 comments on commit 33067c7

Please sign in to comment.