module Gapic::UriTemplate::Parser

A URI template parser. see tools.ietf.org/html/rfc6570 URI Template

@!attribute [r] path_pattern

@return [String] The path pattern to be parsed.

@!attribute [r] segments

@return [Array<Segment|String>] The segments of the parsed path pattern.

Constants

URI_TEMPLATE

@private `/(?<positional>**?)|{(?<name>+?)(?:=(?<template>.+?))?}/`

Public Class Methods

parse_arguments(uri_template) click to toggle source
# File lib/gapic/uri_template/parser.rb, line 35
def self.parse_arguments uri_template
  arguments = []

  while (match = URI_TEMPLATE.match uri_template)
    # The String before the match needs to be added to the segments
    arguments << match[:name] if match[:name]
    uri_template = match.post_match
  end

  arguments
end