@@ -4,5 +4,89 @@ module URI
44 # RFC6068, the mailto URL scheme.
55 #
66 class MailTo < Generic
7+ EMAIL_REGEXP: Regexp
8+
9+ # <!--
10+ # rdoc-file=lib/uri/mailto.rb
11+ # - build(args)
12+ # -->
13+ # ## Description
14+ #
15+ # Creates a new URI::MailTo object from components, with syntax checking.
16+ #
17+ # Components can be provided as an Array or Hash. If an Array is used, the
18+ # components must be supplied as `[to, headers]`.
19+ #
20+ # If a Hash is used, the keys are the component names preceded by colons.
21+ #
22+ # The headers can be supplied as a pre-encoded string, such as
23+ # `"subject=subscribe&cc=address"`, or as an Array of Arrays like `[['subject',
24+ # 'subscribe'], ['cc', 'address']]`.
25+ #
26+ # Examples:
27+ #
28+ # require 'uri'
29+ #
30+ # m1 = URI::MailTo.build(['[email protected] ', 'subject=Ruby']) 31+ # m1.to_s # => "mailto:[email protected] ?subject=Ruby" 32+ #
33+ # m2 = URI::MailTo.build(['[email protected] ', [['Subject', 'Ruby'], ['Cc', '[email protected] ']]]) 34+ # m2.to_s # => "mailto:[email protected] ?Subject=Ruby&[email protected] " 35+ #
36+ # m3 = URI::MailTo.build({:to => '[email protected] ', :headers => [['subject', 'subscribe']]}) 37+ # m3.to_s # => "mailto:[email protected] ?subject=subscribe" 38+ #
39+ def self.build : (Array[String]) -> instance
40+ | ([String, Array[Array[String]]]) -> instance
41+ | (Hash[Symbol, String | Array[Array[String]]]) -> instance
42+
43+ # <!-- rdoc-file=lib/uri/mailto.rb -->
44+ # E-mail headers set by the URL, as an Array of Arrays.
45+ #
46+ def headers : () -> Array[[String, String]]
47+
48+ # <!--
49+ # rdoc-file=lib/uri/mailto.rb
50+ # - headers=(v)
51+ # -->
52+ # Setter for headers `v`.
53+ #
54+ def headers= : (String) -> String
55+
56+ # <!-- rdoc-file=lib/uri/mailto.rb -->
57+ # The primary e-mail address of the URL, as a String.
58+ #
59+ def to : () -> String
60+
61+ # <!--
62+ # rdoc-file=lib/uri/mailto.rb
63+ # - to=(v)
64+ # -->
65+ # Setter for to `v`.
66+ #
67+ def to= : (String) -> String
68+
69+ # <!--
70+ # rdoc-file=lib/uri/mailto.rb
71+ # - to_mailtext()
72+ # -->
73+ # Returns the RFC822 e-mail text equivalent of the URL, as a String.
74+ #
75+ # Example:
76+ #
77+ # require 'uri'
78+ #
79+ # uri = URI.parse("mailto:[email protected] ?Subject=subscribe&cc=myaddr") 80+ # uri.to_mailtext
81+ # # => "To: [email protected] \nSubject: subscribe\nCc: myaddr\n\n\n" 82+ #
83+ def to_mailtext : () -> String
84+
85+ # <!--
86+ # rdoc-file=lib/uri/mailto.rb
87+ # - to_rfc822text()
88+ # -->
89+ #
90+ def to_rfc822text : () -> String
791 end
892end
0 commit comments