Skip to content

Commit

Permalink
add .aslist to Element.
Browse files Browse the repository at this point in the history
  • Loading branch information
aufdemrand committed Apr 8, 2013
1 parent 896f0e7 commit 84ba8cf
Showing 1 changed file with 5 additions and 1 deletion.
Expand Up @@ -19,6 +19,7 @@ public class Element implements dScriptArgument {
* @return a dScript dList
*
*/
@ObjectFetcher("l")
public static Element valueOf(String string) {
if (string == null) return null;

Expand Down Expand Up @@ -94,7 +95,10 @@ public String getAttribute(Attribute attribute) {
return new Element(Boolean.valueOf(element).toString())
.getAttribute(attribute.fulfill(1));

if (attribute.startsWith("substring")) { // suibstring[2|8]
if (attribute.startsWith("aslist"))
return new dList("List", element).getAttribute(attribute.fulfill(1));

if (attribute.startsWith("substring")) { // substring[2|8]
int beginning_index = Integer.valueOf(attribute.getContext(1).split(",")[0]) - 1;
int ending_index = Integer.valueOf(attribute.getContext(1).split(",")[1]) - 1;
return new Element(String.valueOf(element.substring(beginning_index, ending_index)))
Expand Down

0 comments on commit 84ba8cf

Please sign in to comment.