lib/openwfe/expressions/fe_iterator.rb in openwferu-0.9.16 vs lib/openwfe/expressions/fe_iterator.rb in openwferu-0.9.17
- old
+ new
@@ -1,8 +1,8 @@
#
#--
-# Copyright (c) 2007, John Mettraux, OpenWFE.org
+# Copyright (c) 2007-2008, John Mettraux, OpenWFE.org
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
@@ -132,11 +132,11 @@
end
store_itself
get_expression_pool.launch_template(
- self, @iterator.index, @children[0], workitem, vars)
+ self, nil, @iterator.index, @children[0], workitem, vars)
end
end
#
# Iterator instances keep track of the position of an iteration.
@@ -171,15 +171,22 @@
@value_separator = /,\s*/ unless @value_separator
@iteration_index = 0
- raw_list = iterator_expression.lookup_vf_attribute(
- workitem, :value, :prefix => :on)
+ #raw_list = iterator_expression.lookup_vf_attribute(
+ # workitem, :value, :prefix => :on)
+ #raw_list ||= iterator_expression.lookup_attribute(:on, workitem)
- @iteration_list = extract_iteration_list(raw_list)
+ raw_list =
+ iterator_expression.lookup_vf_attribute(
+ workitem, :value, :prefix => :on) ||
+ iterator_expression.lookup_vf_attribute(
+ workitem, nil, :prefix => :on)
+ @iteration_list = extract_iteration_list raw_list
+
workitem.attributes[ITERATOR_COUNT] = @iteration_list.length
end
#
# Has the iteration a next element ?
@@ -281,11 +288,11 @@
def extract_iteration_list (raw_list)
if is_suitable_list?(raw_list)
raw_list
else
- extract_list_from_string(raw_list.to_s)
+ extract_list_from_string raw_list.to_s
end
end
#
# Returns true if the given instance can be directly
@@ -302,10 +309,10 @@
# Extracts the list from the string (comma separated list
# usually).
#
def extract_list_from_string (s)
- s.split(@value_separator)
+ s.split @value_separator
end
end
end