method
check_to
v2_2_9 -
Show latest stable
- Class:
URI::MailTo
check_to(v)private
check the to v component
# File lib/uri/mailto.rb, line 169
def check_to(v)
return true unless v
return true if v.size == 0
v.split(/[,;]/).each do |addr|
# check url safety as path-rootless
if /\A(?:%\h\h|[!$&-.0-;=@-Z_a-z~])*\z/ !~ addr
raise InvalidComponentError,
"an address in 'to' is invalid as URI #{addr.dump}"
end
# check addr-spec
# don't s/\+/ /g
addr.gsub!(/%\h\h/, URI::TBLDECWWWCOMP_)
if EMAIL_REGEXP !~ addr
raise InvalidComponentError,
"an address in 'to' is invalid as uri-escaped addr-spec #{addr.dump}"
end
end
return true
end Related methods
- Instance methods
- headers=
- to=
- to_mailtext
- to_rfc822text
- to_s
- Class methods
- build
- new
- Protected methods
-
set_headers -
set_to - Private methods
-
check_headers -
check_to