class Bundler::URI::MailTo
def to_mailtext
# => "To: ruby-list@ruby-lang.org\nSubject: subscribe\nCc: myaddr\n\n\n"
uri.to_mailtext
uri = Bundler::URI.parse("mailto:ruby-list@ruby-lang.org?Subject=subscribe&cc=myaddr")
require 'bundler/vendor/uri/lib/uri'
Example:
Returns the RFC822 e-mail text equivalent of the URL, as a String.
def to_mailtext to = Bundler::URI.decode_www_form_component(@to) head = '' body = '' @headers.each do |x| case x[0] when 'body' body = Bundler::URI.decode_www_form_component(x[1]) when 'to' to << ', ' + Bundler::URI.decode_www_form_component(x[1]) else head << Bundler::URI.decode_www_form_component(x[0]).capitalize + ': ' + Bundler::URI.decode_www_form_component(x[1]) + "\n" end end "To: #{to} ad} dy} end