class Addressable::Template
def extract_list_operator(value, processor, argument, variables, mapping)
-
(String)- The extracted result.
Parameters:
-
mapping(Hash) -- The mapping of variables to values. -
variables(Array) -- The variables the operator is working on. -
argument(String) -- The argument to the operator. -
processor(#restore) -- The processor object. -
value(String) -- The unparsed value to extract from.
def extract_list_operator(value, processor, argument, variables, mapping) if variables.size != 1 raise InvalidTemplateOperatorError, "Template operator 'list' takes exactly one variable." end values = value.split(argument, -1) values.pop if values[-1] == "" if processor && processor.respond_to?(:restore) values.map! { |value| processor.restore(variables.first, value) } end if mapping[variables.first] == nil || mapping[variables.first] == values mapping[variables.first] = values else raise TemplateOperatorAbortedError, "Value mismatch for repeated variable." end end