From 3da03397ce1dca2eaf21149dcdc88a212b6afdc2 Mon Sep 17 00:00:00 2001 From: akira Date: Wed, 10 Sep 2008 09:34:49 +0000 Subject: * 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 --- lib/uri/mailto.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lib/uri/mailto.rb') 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 -- cgit v1.2.3