diff options
author | akira <akira@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-09-10 09:34:49 +0000 |
---|---|---|
committer | akira <akira@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-09-10 09:34:49 +0000 |
commit | 3da03397ce1dca2eaf21149dcdc88a212b6afdc2 (patch) | |
tree | f0221b0fc3f567ef4e5cc2684f4d1a652f806f53 /lib/uri/mailto.rb | |
parent | 0bedb3e5b1e80b5fdac2086f9b0c54df56f7313b (diff) | |
download | ruby-3da03397ce1dca2eaf21149dcdc88a212b6afdc2.tar.gz |
* lib/uri/common.rb (URI::Parser): new class.
* lib/uri/mailto.rb, lib/uri/generic.rb: follow the above change.
* test/uri/test_parser.rb: added tests for URI::Parser.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19282 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/uri/mailto.rb')
-rw-r--r-- | lib/uri/mailto.rb | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/uri/mailto.rb b/lib/uri/mailto.rb index 3a9d15318f..c66c95fcd0 100644 --- a/lib/uri/mailto.rb +++ b/lib/uri/mailto.rb @@ -159,7 +159,7 @@ module URI return true unless v return true if v.size == 0 - if OPAQUE !~ v || /\A#{MAILBOX_PATTERN}*\z/o !~ v + if @parser.regexp[:OPAQUE] !~ v || /\A#{MAILBOX_PATTERN}*\z/o !~ v raise InvalidComponentError, "bad component(expected opaque component): #{v}" end @@ -183,7 +183,7 @@ module URI return true unless v return true if v.size == 0 - if OPAQUE !~ v || + if @parser.regexp[:OPAQUE] !~ v || /\A(#{HEADER_PATTERN}(?:\&#{HEADER_PATTERN})*)\z/o !~ v raise InvalidComponentError, "bad component(expected opaque component): #{v}" @@ -239,18 +239,18 @@ module URI # # => "To: ruby-list@ruby-lang.org\nSubject: subscribe\nCc: myaddr\n\n\n" # def to_mailtext - to = URI::unescape(@to) + to = @parser.unescape(@to) head = '' body = '' @headers.each do |x| case x[0] when 'body' - body = URI::unescape(x[1]) + body = @parser.unescape(x[1]) when 'to' - to << ', ' + URI::unescape(x[1]) + to << ', ' + @parser.unescape(x[1]) else - head << URI::unescape(x[0]).capitalize + ': ' + - URI::unescape(x[1]) + "\n" + head << @parser.unescape(x[0]).capitalize + ': ' + + @parser.unescape(x[1]) + "\n" end end |