class Addressable::Template

def ordered_variable_defaults

def ordered_variable_defaults
  @ordered_variable_defaults ||= (begin
    expansions, expansion_regexp = parse_template_pattern(pattern)
    expansions.inject([]) do |result, expansion|
      case expansion
      when OPERATOR_EXPANSION
        _, _, variables, mapping = parse_template_expansion(expansion)
        result.concat variables.map { |var| [var, mapping[var]] }
      when VARIABLE_EXPANSION
        result << [$1, $2]
      end
      result
    end
  end)
end