lib/roda/request.rb
def _match_string(str)
          rp = @remaining_path
          length = str.length

          match = case rp.rindex(str, length)
          when nil
            # segment does not match, most common case
            return
          when 1
            # segment matches, check first character is /
            rp.getbyte(0) == 47
          else # must be 0
            # segment matches at first character, only a match if
            # empty string given and first character is /
            length == 0 && rp.getbyte(0) == 47
          end

          if match 
            length += 1
            case rp.getbyte(length)
            when 47
              # next character is /, update remaining path to rest of string
              @remaining_path = rp[length, 100000000]
            when nil
              # end of string, so remaining path is empty
              @remaining_path = ""
            # else
              # Any other value means this was partial segment match,
              # so we return nil in that case without updating the
              # remaining_path.  No need for explicit else clause.
            end
          end
        end
# Match the given string to the request path.  Matches only if the
# request path ends with the string or if the next character in the
# request path is a slash (indicating a new segment).
Match the given string to the request path.  Matches only if the
request path ends with the string or if the next character in the
request path is a slash (indicating a new segment).
Match the given string to the request path . Matches only if the request path ends with the string or if the next character in the request path is a slash ( indicating a new segment ) .
def _match_string(str)
          rp = @remaining_path
          length = str.length
          match = case rp.rindex(str, length)
          when nil
            return
          when 1
            rp.getbyte(0) == 47
          else 
            length == 0 && rp.getbyte(0) == 47
          end
          if match 
            length += 1
            case rp.getbyte(length)
            when 47
              @remaining_path = rp[length, 100000000]
            when nil
              @remaining_path = ""
            end
          end
        end
def _match_string ( str ) rp = @remaining_path length = str . length match = case rp . rindex ( str , length ) when nil return when 1 rp . getbyte ( 0 ) == 47 else length == 0 && rp . getbyte ( 0 ) == 47 end if match length += 1 case rp . getbyte ( length ) when 47 @remaining_path = rp [ length , 100000000 ] when nil @remaining_path = "" end end end
Match the given string to the request path.
Match the given string to the request path .
# segment does not match, most common case # segment matches, check first character is / # must be 0 # segment matches at first character, only a match if # empty string given and first character is / # next character is /, update remaining path to rest of string # end of string, so remaining path is empty # else # Any other value means this was partial segment match, # so we return nil in that case without updating the # remaining_path.  No need for explicit else clause.
str