class Bundler::URI::MailTo
def self.build(args)
m3.to_s # => "mailto:listman@example.com?subject=subscribe"
m3 = Bundler::URI::MailTo.build({:to => 'listman@example.com', :headers => [['subject', 'subscribe']]})
m2.to_s # => "mailto:john@example.com?Subject=Ruby&Cc=jack@example.com"
m2 = Bundler::URI::MailTo.build(['john@example.com', [['Subject', 'Ruby'], ['Cc', 'jack@example.com']]])
m1.to_s # => "mailto:joe@example.com?subject=Ruby"
m1 = Bundler::URI::MailTo.build(['joe@example.com', 'subject=Ruby'])
require 'bundler/vendor/uri/lib/uri'
Examples:
like
[['subject', 'subscribe'], ['cc', 'address']]
."subject=subscribe&cc=address"
, or as an Array of ArraysThe headers can be supplied as a pre-encoded string, such as
If a Hash is used, the keys are the component names preceded by colons.
the components must be supplied as
[to, headers]
.Components can be provided as an Array or Hash. If an Array is used,
Creates a new Bundler::URI::MailTo object from components, with syntax checking.
== Description
def self.build(args) tmp = Util.make_components_hash(self, args) case tmp[:to] when Array tmp[:opaque] = tmp[:to].join(',') when String tmp[:opaque] = tmp[:to].dup else tmp[:opaque] = '' end if tmp[:headers] query = case tmp[:headers] when Array tmp[:headers].collect { |x| if x.kind_of?(Array) x[0] + '=' + x[1..-1].join else x.to_s end }.join('&') when Hash tmp[:headers].collect { |h,v| h + '=' + v }.join('&') else tmp[:headers].to_s end unless query.empty? tmp[:opaque] << '?' << query end end super(tmp) end