/// <summary>
        /// Returns the segments that make up the specified path.
        /// </summary>
        /// <param name="path">The path to to return the segments for.</param>
        /// <returns>Array of segments that make up the specified path.</returns>
        public static IEnumerable <string> GetPathSegments(string path)
        {
            var segments     = UriPathParser.Parse(path);
            var pathSegments = new string[segments.Length];

            for (var i = 0; i < segments.Length; i++)
            {
                pathSegments[i] = segments[i].Segment;
            }

            return(pathSegments);
        }
        /// <summary>
        /// Called when the <see cref="Segment"/> needs parsing to extract the
        /// <see cref="Text"/> and <see cref="Predicate"/> values.
        /// </summary>
        protected virtual void OnParse()
        {
            _text      = string.Empty;
            _predicate = string.Empty;

            if (!string.IsNullOrEmpty(_segment))
            {
                var segments = UriPathParser.Parse(_segment);

                if (segments.Length > 0)
                {
                    var segment = segments[0];

                    _text      = segment.Text;
                    _predicate = segment.Predicate;
                }
            }
        }
 /// <summary>
 /// Builds an enumerable of <see cref="UriPathSegment"/> objects from an enumerable of <see cref="String"/>
 /// <see cref="Array"/>.
 /// </summary>
 /// <param name="segments"><see cref="Array"/> of strings.</param>
 /// <returns><see cref="Array"/> of <see cref="UriPathSegment"/> objects.</returns>
 public static IEnumerable <UriPathSegment> FromStrings(IEnumerable <string> segments)
 {
     return(segments.SelectMany(segment => UriPathParser.Parse(segment)).ToArray());
 }