class Addressable::Template

def extract_join_operator(value, processor, argument, variables, mapping)

Returns:
  • (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_join_operator(value, processor, argument, variables, mapping)
  unparsed_values = value.split(argument)
  parsed_variables = []
  for unparsed_value in unparsed_values
    name = unparsed_value[/^(.+?)=(.+)$/, 1]
    parsed_variables << name
    parsed_value = unparsed_value[/^(.+?)=(.+)$/, 2]
    if processor && processor.respond_to?(:restore)
      parsed_value = processor.restore(name, parsed_value)
    end
    if mapping[name] == nil || mapping[name] == parsed_value
      mapping[name] = parsed_value
    else
      raise TemplateOperatorAbortedError,
        "Value mismatch for repeated variable."
    end
  end
  for variable in variables
    if !parsed_variables.include?(variable) && mapping[variable] != nil
      raise TemplateOperatorAbortedError,
        "Value mismatch for repeated variable."
    end
  end
  if (parsed_variables & variables) != parsed_variables
    raise TemplateOperatorAbortedError,
      "Template operator 'join' variable mismatch: " +
      "#{parsed_variables.inspect}, #{variables.inspect}"
  end
end