Skip to content

Commit aa09b1e

Browse files
author
José Valim
committed
Improve docs for URI
1 parent 8cb4c71 commit aa09b1e

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

lib/elixir/lib/uri.ex

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,17 +145,20 @@ defmodule URI do
145145
encode(to_string(k)) <> "=" <> encode(to_string(v))
146146
end
147147

148-
# RFC3986, section 2.2
149148
@doc """
150-
Returns true if the character is a "reserved" character in a URI.
149+
Checks if the character is a "reserved" character in a URI.
150+
151+
Reserved characters are specified in RFC3986, section 2.2.
151152
"""
152153
def char_reserved?(c) do
153154
c in ':/?#[]@!$&\'()*+,;='
154155
end
155156

156-
# RFC3986, section 2.3
157+
#
157158
@doc """
158-
Returns true if the character is a "unreserved" character in a URI.
159+
Checks if the character is a "unreserved" character in a URI.
160+
161+
Unreserved characters are specified in RFC3986, section 2.3.
159162
"""
160163
def char_unreserved?(c) do
161164
c in ?0..?9 or
@@ -165,7 +168,10 @@ defmodule URI do
165168
end
166169

167170
@doc """
168-
Returns true if the character is allowed unescaped in a URI.
171+
Checks if the character is allowed unescaped in a URI.
172+
173+
This is the default used by `URI.encode/2` where both
174+
reserved and unreserved characters are kept unescaped.
169175
"""
170176
def char_unescaped?(c) do
171177
char_reserved?(c) or char_unreserved?(c)

0 commit comments

Comments
 (0)