Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

Commit

Permalink
creating a new pattern for this each time is a little silly
Browse files Browse the repository at this point in the history
  • Loading branch information
spullara committed Nov 27, 2010
1 parent 1bef5fa commit d6ab41a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/java/com/sampullara/mustache/Scope.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import java.util.concurrent.Future;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Pattern;

/**
* The scope of the executing Mustache can include an object and a map of strings. Each scope can also have a
Expand All @@ -25,6 +26,7 @@ public class Scope extends HashMap {
protected static Map<Class, Map<String, AccessibleObject>> cache = new ConcurrentHashMap<Class, Map<String, AccessibleObject>>();
public static final Iterable EMPTY = new ArrayList(0);
public static final Object NULL = new Object() { public String toString() { return ""; }};
private static final Pattern DOT_PATTERN = Pattern.compile("\\.");

private Object parent;
private Scope parentScope;
Expand Down Expand Up @@ -67,7 +69,7 @@ public Object get(Object o) {
public Object get(Object o, Scope scope) {
String name = o.toString();
Object value = null;
String[] components = name.split("\\.");
String[] components = DOT_PATTERN.split(name);
Scope current = this;
Scope currentScope = scope;
for (String component : components) {
Expand Down

0 comments on commit d6ab41a

Please sign in to comment.