Skip to content

Commit

Permalink
move uriregex to const
Browse files Browse the repository at this point in the history
  • Loading branch information
igrigorik committed Feb 19, 2011
1 parent ecd13b9 commit 8b555de
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/addressable/uri.rb
Expand Up @@ -63,6 +63,8 @@ module CharacterClasses
SLASH = '/'
EMPTYSTR = ''

URIREGEX = /^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/

##
# Returns a URI object based on the parsed string.
#
Expand Down Expand Up @@ -94,9 +96,7 @@ def self.parse(uri)
end if not uri.is_a? String

# This Regexp supplied as an example in RFC 3986, and it works great.
uri_regex =
/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/
scan = uri.scan(uri_regex)
scan = uri.scan(URIREGEX)
fragments = scan[0]
scheme = fragments[1]
authority = fragments[3]
Expand Down

0 comments on commit 8b555de

Please sign in to comment.