addressable 0.1.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -556,7 +556,7 @@ span.run100 {
556
556
  </head>
557
557
  <body>
558
558
  <h3>C0 code coverage information</h3>
559
- <p>Generated on Sun Oct 28 17:27:34 -0400 2007 with <a href='http://eigenclass.org/hiki.rb?rcov'>rcov 0.8.0</a>
559
+ <p>Generated on Sat Nov 03 20:49:05 -0400 2007 with <a href='http://eigenclass.org/hiki.rb?rcov'>rcov 0.8.0</a>
560
560
  </p>
561
561
  <hr /><pre><span class='marked0'>Code reported as executed by Ruby looks like this...
562
562
  </span><span class='marked1'>and this: this line is also marked as covered.
@@ -619,38 +619,38 @@ span.run100 {
619
619
  </td>
620
620
  </tr>
621
621
  </tbody>
622
- </table><pre><span class="inferred1"><a name="line1" /> 1 #--
623
- </span><span class="inferred0"><a name="line2" /> 2 # Addressable, Copyright (c) 2006-2007 Bob Aman
624
- </span><span class="inferred1"><a name="line3" /> 3 #
625
- </span><span class="inferred0"><a name="line4" /> 4 # Permission is hereby granted, free of charge, to any person obtaining
626
- </span><span class="inferred1"><a name="line5" /> 5 # a copy of this software and associated documentation files (the
627
- </span><span class="inferred0"><a name="line6" /> 6 # &quot;Software&quot;), to deal in the Software without restriction, including
628
- </span><span class="inferred1"><a name="line7" /> 7 # without limitation the rights to use, copy, modify, merge, publish,
629
- </span><span class="inferred0"><a name="line8" /> 8 # distribute, sublicense, and/or sell copies of the Software, and to
630
- </span><span class="inferred1"><a name="line9" /> 9 # permit persons to whom the Software is furnished to do so, subject to
631
- </span><span class="inferred0"><a name="line10" />10 # the following conditions:
632
- </span><span class="inferred1"><a name="line11" />11 #
633
- </span><span class="inferred0"><a name="line12" />12 # The above copyright notice and this permission notice shall be
634
- </span><span class="inferred1"><a name="line13" />13 # included in all copies or substantial portions of the Software.
635
- </span><span class="inferred0"><a name="line14" />14 #
636
- </span><span class="inferred1"><a name="line15" />15 # THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND,
637
- </span><span class="inferred0"><a name="line16" />16 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
638
- </span><span class="inferred1"><a name="line17" />17 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
639
- </span><span class="inferred0"><a name="line18" />18 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
640
- </span><span class="inferred1"><a name="line19" />19 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
641
- </span><span class="inferred0"><a name="line20" />20 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
642
- </span><span class="inferred1"><a name="line21" />21 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
643
- </span><span class="inferred0"><a name="line22" />22 #++
644
- </span><span class="inferred1"><a name="line23" />23
645
- </span><span class="marked0"><a name="line24" />24 module Addressable
646
- </span><span class="marked1"><a name="line25" />25 module ADDRESSABLE_VERSION #:nodoc:
647
- </span><span class="marked0"><a name="line26" />26 MAJOR = 0
648
- </span><span class="marked1"><a name="line27" />27 MINOR = 1
649
- </span><span class="marked0"><a name="line28" />28 TINY = 2
650
- </span><span class="inferred1"><a name="line29" />29
651
- </span><span class="marked0"><a name="line30" />30 STRING = [MAJOR, MINOR, TINY].join('.')
652
- </span><span class="inferred1"><a name="line31" />31 end
653
- </span><span class="inferred0"><a name="line32" />32 end
622
+ </table><pre><span class="inferred0"><a name="line1" /> 1 #--
623
+ </span><span class="inferred1"><a name="line2" /> 2 # Addressable, Copyright (c) 2006-2007 Bob Aman
624
+ </span><span class="inferred0"><a name="line3" /> 3 #
625
+ </span><span class="inferred1"><a name="line4" /> 4 # Permission is hereby granted, free of charge, to any person obtaining
626
+ </span><span class="inferred0"><a name="line5" /> 5 # a copy of this software and associated documentation files (the
627
+ </span><span class="inferred1"><a name="line6" /> 6 # &quot;Software&quot;), to deal in the Software without restriction, including
628
+ </span><span class="inferred0"><a name="line7" /> 7 # without limitation the rights to use, copy, modify, merge, publish,
629
+ </span><span class="inferred1"><a name="line8" /> 8 # distribute, sublicense, and/or sell copies of the Software, and to
630
+ </span><span class="inferred0"><a name="line9" /> 9 # permit persons to whom the Software is furnished to do so, subject to
631
+ </span><span class="inferred1"><a name="line10" />10 # the following conditions:
632
+ </span><span class="inferred0"><a name="line11" />11 #
633
+ </span><span class="inferred1"><a name="line12" />12 # The above copyright notice and this permission notice shall be
634
+ </span><span class="inferred0"><a name="line13" />13 # included in all copies or substantial portions of the Software.
635
+ </span><span class="inferred1"><a name="line14" />14 #
636
+ </span><span class="inferred0"><a name="line15" />15 # THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND,
637
+ </span><span class="inferred1"><a name="line16" />16 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
638
+ </span><span class="inferred0"><a name="line17" />17 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
639
+ </span><span class="inferred1"><a name="line18" />18 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
640
+ </span><span class="inferred0"><a name="line19" />19 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
641
+ </span><span class="inferred1"><a name="line20" />20 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
642
+ </span><span class="inferred0"><a name="line21" />21 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
643
+ </span><span class="inferred1"><a name="line22" />22 #++
644
+ </span><span class="inferred0"><a name="line23" />23
645
+ </span><span class="marked1"><a name="line24" />24 module Addressable
646
+ </span><span class="marked0"><a name="line25" />25 module ADDRESSABLE_VERSION #:nodoc:
647
+ </span><span class="marked1"><a name="line26" />26 MAJOR = 1
648
+ </span><span class="marked0"><a name="line27" />27 MINOR = 0
649
+ </span><span class="marked1"><a name="line28" />28 TINY = 0
650
+ </span><span class="inferred0"><a name="line29" />29
651
+ </span><span class="marked1"><a name="line30" />30 STRING = [MAJOR, MINOR, TINY].join('.')
652
+ </span><span class="inferred0"><a name="line31" />31 end
653
+ </span><span class="inferred1"><a name="line32" />32 end
654
654
  </span></pre><hr /> <p>Generated using the <a href='http://eigenclass.org/hiki.rb?rcov'>rcov code coverage analysis tool for Ruby</a> version 0.8.0.</p><p>
655
655
  <a href='http://validator.w3.org/check/referer'>
656
656
  <img src='http://www.w3.org/Icons/valid-xhtml10' height='31' alt='Valid XHTML 1.0!' width='88' />
@@ -93,62 +93,63 @@ RFC 3986, 3987.
93
93
  <h3 class="section-bar">Methods</h3>
94
94
 
95
95
  <div class="name-list">
96
- <a href="#M000040">+</a>&nbsp;&nbsp;
97
- <a href="#M000051">==</a>&nbsp;&nbsp;
98
- <a href="#M000050">===</a>&nbsp;&nbsp;
99
- <a href="#M000039">absolute?</a>&nbsp;&nbsp;
100
- <a href="#M000022">authority</a>&nbsp;&nbsp;
101
- <a href="#M000023">authority=</a>&nbsp;&nbsp;
102
- <a href="#M000031">basename</a>&nbsp;&nbsp;
103
- <a href="#M000002">convert_path</a>&nbsp;&nbsp;
104
- <a href="#M000049">display_uri</a>&nbsp;&nbsp;
105
- <a href="#M000053">dup</a>&nbsp;&nbsp;
106
- <a href="#M000008">encode</a>&nbsp;&nbsp;
107
- <a href="#M000006">encode_segment</a>&nbsp;&nbsp;
108
- <a href="#M000052">eql?</a>&nbsp;&nbsp;
109
- <a href="#M000003">expand_template</a>&nbsp;&nbsp;
110
- <a href="#M000032">extname</a>&nbsp;&nbsp;
111
- <a href="#M000010">extract</a>&nbsp;&nbsp;
112
- <a href="#M000004">extract_mapping</a>&nbsp;&nbsp;
113
- <a href="#M000035">fragment</a>&nbsp;&nbsp;
114
- <a href="#M000036">fragment=</a>&nbsp;&nbsp;
115
- <a href="#M000020">host</a>&nbsp;&nbsp;
116
- <a href="#M000021">host=</a>&nbsp;&nbsp;
117
- <a href="#M000056">inspect</a>&nbsp;&nbsp;
118
- <a href="#M000037">ip_based?</a>&nbsp;&nbsp;
119
- <a href="#M000024">ip_based_schemes</a>&nbsp;&nbsp;
120
- <a href="#M000042">join</a>&nbsp;&nbsp;
121
- <a href="#M000005">join</a>&nbsp;&nbsp;
122
- <a href="#M000044">join!</a>&nbsp;&nbsp;
123
- <a href="#M000041">merge</a>&nbsp;&nbsp;
124
- <a href="#M000043">merge!</a>&nbsp;&nbsp;
125
- <a href="#M000011">new</a>&nbsp;&nbsp;
126
- <a href="#M000047">normalize</a>&nbsp;&nbsp;
127
- <a href="#M000048">normalize!</a>&nbsp;&nbsp;
128
- <a href="#M000009">normalized_encode</a>&nbsp;&nbsp;
96
+ <a href="#M000041">+</a>&nbsp;&nbsp;
97
+ <a href="#M000052">==</a>&nbsp;&nbsp;
98
+ <a href="#M000051">===</a>&nbsp;&nbsp;
99
+ <a href="#M000040">absolute?</a>&nbsp;&nbsp;
100
+ <a href="#M000023">authority</a>&nbsp;&nbsp;
101
+ <a href="#M000024">authority=</a>&nbsp;&nbsp;
102
+ <a href="#M000032">basename</a>&nbsp;&nbsp;
103
+ <a href="#M000003">convert_path</a>&nbsp;&nbsp;
104
+ <a href="#M000050">display_uri</a>&nbsp;&nbsp;
105
+ <a href="#M000054">dup</a>&nbsp;&nbsp;
106
+ <a href="#M000009">encode</a>&nbsp;&nbsp;
107
+ <a href="#M000007">encode_segment</a>&nbsp;&nbsp;
108
+ <a href="#M000053">eql?</a>&nbsp;&nbsp;
109
+ <a href="#M000004">expand_template</a>&nbsp;&nbsp;
110
+ <a href="#M000033">extname</a>&nbsp;&nbsp;
111
+ <a href="#M000011">extract</a>&nbsp;&nbsp;
112
+ <a href="#M000005">extract_mapping</a>&nbsp;&nbsp;
113
+ <a href="#M000036">fragment</a>&nbsp;&nbsp;
114
+ <a href="#M000037">fragment=</a>&nbsp;&nbsp;
115
+ <a href="#M000002">heuristic_parse</a>&nbsp;&nbsp;
116
+ <a href="#M000021">host</a>&nbsp;&nbsp;
117
+ <a href="#M000022">host=</a>&nbsp;&nbsp;
118
+ <a href="#M000057">inspect</a>&nbsp;&nbsp;
119
+ <a href="#M000038">ip_based?</a>&nbsp;&nbsp;
120
+ <a href="#M000025">ip_based_schemes</a>&nbsp;&nbsp;
121
+ <a href="#M000043">join</a>&nbsp;&nbsp;
122
+ <a href="#M000006">join</a>&nbsp;&nbsp;
123
+ <a href="#M000045">join!</a>&nbsp;&nbsp;
124
+ <a href="#M000042">merge</a>&nbsp;&nbsp;
125
+ <a href="#M000044">merge!</a>&nbsp;&nbsp;
126
+ <a href="#M000012">new</a>&nbsp;&nbsp;
127
+ <a href="#M000048">normalize</a>&nbsp;&nbsp;
128
+ <a href="#M000049">normalize!</a>&nbsp;&nbsp;
129
+ <a href="#M000010">normalized_encode</a>&nbsp;&nbsp;
129
130
  <a href="#M000001">parse</a>&nbsp;&nbsp;
130
- <a href="#M000016">password</a>&nbsp;&nbsp;
131
- <a href="#M000017">password=</a>&nbsp;&nbsp;
132
- <a href="#M000029">path</a>&nbsp;&nbsp;
133
- <a href="#M000030">path=</a>&nbsp;&nbsp;
134
- <a href="#M000026">port</a>&nbsp;&nbsp;
135
- <a href="#M000027">port=</a>&nbsp;&nbsp;
136
- <a href="#M000033">query</a>&nbsp;&nbsp;
137
- <a href="#M000034">query=</a>&nbsp;&nbsp;
138
- <a href="#M000038">relative?</a>&nbsp;&nbsp;
139
- <a href="#M000045">route_from</a>&nbsp;&nbsp;
140
- <a href="#M000046">route_to</a>&nbsp;&nbsp;
141
- <a href="#M000012">scheme</a>&nbsp;&nbsp;
142
- <a href="#M000013">scheme=</a>&nbsp;&nbsp;
143
- <a href="#M000025">scheme_mapping</a>&nbsp;&nbsp;
144
- <a href="#M000028">specified_port</a>&nbsp;&nbsp;
145
- <a href="#M000055">to_h</a>&nbsp;&nbsp;
146
- <a href="#M000054">to_s</a>&nbsp;&nbsp;
147
- <a href="#M000007">unencode_segment</a>&nbsp;&nbsp;
148
- <a href="#M000014">user</a>&nbsp;&nbsp;
149
- <a href="#M000015">user=</a>&nbsp;&nbsp;
150
- <a href="#M000018">userinfo</a>&nbsp;&nbsp;
151
- <a href="#M000019">userinfo=</a>&nbsp;&nbsp;
131
+ <a href="#M000017">password</a>&nbsp;&nbsp;
132
+ <a href="#M000018">password=</a>&nbsp;&nbsp;
133
+ <a href="#M000030">path</a>&nbsp;&nbsp;
134
+ <a href="#M000031">path=</a>&nbsp;&nbsp;
135
+ <a href="#M000027">port</a>&nbsp;&nbsp;
136
+ <a href="#M000028">port=</a>&nbsp;&nbsp;
137
+ <a href="#M000034">query</a>&nbsp;&nbsp;
138
+ <a href="#M000035">query=</a>&nbsp;&nbsp;
139
+ <a href="#M000039">relative?</a>&nbsp;&nbsp;
140
+ <a href="#M000046">route_from</a>&nbsp;&nbsp;
141
+ <a href="#M000047">route_to</a>&nbsp;&nbsp;
142
+ <a href="#M000013">scheme</a>&nbsp;&nbsp;
143
+ <a href="#M000014">scheme=</a>&nbsp;&nbsp;
144
+ <a href="#M000026">scheme_mapping</a>&nbsp;&nbsp;
145
+ <a href="#M000029">specified_port</a>&nbsp;&nbsp;
146
+ <a href="#M000056">to_hash</a>&nbsp;&nbsp;
147
+ <a href="#M000055">to_s</a>&nbsp;&nbsp;
148
+ <a href="#M000008">unencode_segment</a>&nbsp;&nbsp;
149
+ <a href="#M000015">user</a>&nbsp;&nbsp;
150
+ <a href="#M000016">user=</a>&nbsp;&nbsp;
151
+ <a href="#M000019">userinfo</a>&nbsp;&nbsp;
152
+ <a href="#M000020">userinfo=</a>&nbsp;&nbsp;
152
153
  </div>
153
154
  </div>
154
155
 
@@ -193,67 +194,67 @@ Class <a href="URI/InvalidURIError.html" class="link">Addressable::URI::InvalidU
193
194
  <div id="methods">
194
195
  <h3 class="section-bar">Public Class methods</h3>
195
196
 
196
- <div id="method-M000002" class="method-detail">
197
- <a name="M000002"></a>
197
+ <div id="method-M000003" class="method-detail">
198
+ <a name="M000003"></a>
198
199
 
199
200
  <div class="method-heading">
200
- <a href="#M000002" class="method-signature">
201
+ <a href="#M000003" class="method-signature">
201
202
  <span class="method-name">convert_path</span><span class="method-args">(path)</span>
202
203
  </a>
203
204
  </div>
204
205
 
205
206
  <div class="method-description">
206
207
  <p>
207
- Converts a <a href="URI.html#M000029">path</a> to a file protocol <a
208
- href="URI.html">URI</a>. If the <a href="URI.html#M000029">path</a>
208
+ Converts a <a href="URI.html#M000030">path</a> to a file protocol <a
209
+ href="URI.html">URI</a>. If the <a href="URI.html#M000030">path</a>
209
210
  supplied is relative, it will be returned as a relative <a
210
- href="URI.html">URI</a>. If the <a href="URI.html#M000029">path</a>
211
+ href="URI.html">URI</a>. If the <a href="URI.html#M000030">path</a>
211
212
  supplied is actually a <a href="URI.html">URI</a>, it will return the
212
213
  parsed <a href="URI.html">URI</a>.
213
214
  </p>
214
215
  <p><a class="source-toggle" href="#"
215
- onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
216
- <div class="method-source-code" id="M000002-source">
216
+ onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
217
+ <div class="method-source-code" id="M000003-source">
217
218
  <pre>
218
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 124</span>
219
- 124: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">convert_path</span>(<span class="ruby-identifier">path</span>)
220
- 125: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">path</span>.<span class="ruby-identifier">nil?</span>
221
- 126:
222
- 127: <span class="ruby-identifier">converted_uri</span> = <span class="ruby-identifier">path</span>.<span class="ruby-identifier">strip</span>
223
- 128: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">converted_uri</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">converted_uri</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;/&quot;</span>
224
- 129: <span class="ruby-identifier">converted_uri</span> = <span class="ruby-value str">&quot;file://&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">converted_uri</span>
225
- 130: <span class="ruby-keyword kw">end</span>
226
- 131: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">converted_uri</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span> <span class="ruby-operator">&amp;&amp;</span>
227
- 132: <span class="ruby-identifier">converted_uri</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/^[a-zA-Z]:[\\\/]/</span>).<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
228
- 133: <span class="ruby-identifier">converted_uri</span> = <span class="ruby-value str">&quot;file:///&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">converted_uri</span>
229
- 134: <span class="ruby-keyword kw">end</span>
230
- 135: <span class="ruby-identifier">converted_uri</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/^file:\/*/i</span>, <span class="ruby-value str">&quot;file:///&quot;</span>)
231
- 136: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">converted_uri</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^file:/i</span>
232
- 137: <span class="ruby-comment cmt"># Adjust windows-style uris</span>
233
- 138: <span class="ruby-identifier">converted_uri</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/^file:\/\/\/([a-zA-Z])\|/i</span>, <span class="ruby-value str">'file:///\1:'</span>)
234
- 139: <span class="ruby-identifier">converted_uri</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/\\/</span>, <span class="ruby-value str">'/'</span>)
235
- 140: <span class="ruby-identifier">converted_uri</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">converted_uri</span>).<span class="ruby-identifier">normalize</span>
236
- 141: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">converted_uri</span>.<span class="ruby-identifier">path</span>) <span class="ruby-operator">&amp;&amp;</span>
237
- 142: <span class="ruby-constant">File</span>.<span class="ruby-identifier">stat</span>(<span class="ruby-identifier">converted_uri</span>.<span class="ruby-identifier">path</span>).<span class="ruby-identifier">directory?</span>
238
- 143: <span class="ruby-identifier">converted_uri</span>.<span class="ruby-identifier">path</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/\/$/</span>, <span class="ruby-value str">&quot;&quot;</span>)
239
- 144: <span class="ruby-identifier">converted_uri</span>.<span class="ruby-identifier">path</span> = <span class="ruby-identifier">converted_uri</span>.<span class="ruby-identifier">path</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'/'</span>
240
- 145: <span class="ruby-keyword kw">end</span>
241
- 146: <span class="ruby-keyword kw">else</span>
242
- 147: <span class="ruby-identifier">converted_uri</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">converted_uri</span>)
243
- 148: <span class="ruby-keyword kw">end</span>
244
- 149:
245
- 150: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">converted_uri</span>
246
- 151: <span class="ruby-keyword kw">end</span>
219
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 144</span>
220
+ 144: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">convert_path</span>(<span class="ruby-identifier">path</span>)
221
+ 145: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">path</span>.<span class="ruby-identifier">nil?</span>
222
+ 146:
223
+ 147: <span class="ruby-identifier">converted_uri</span> = <span class="ruby-identifier">path</span>.<span class="ruby-identifier">strip</span>
224
+ 148: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">converted_uri</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">converted_uri</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;/&quot;</span>
225
+ 149: <span class="ruby-identifier">converted_uri</span> = <span class="ruby-value str">&quot;file://&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">converted_uri</span>
226
+ 150: <span class="ruby-keyword kw">end</span>
227
+ 151: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">converted_uri</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span> <span class="ruby-operator">&amp;&amp;</span>
228
+ 152: <span class="ruby-identifier">converted_uri</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/^[a-zA-Z]:[\\\/]/</span>).<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
229
+ 153: <span class="ruby-identifier">converted_uri</span> = <span class="ruby-value str">&quot;file:///&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">converted_uri</span>
230
+ 154: <span class="ruby-keyword kw">end</span>
231
+ 155: <span class="ruby-identifier">converted_uri</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/^file:\/*/i</span>, <span class="ruby-value str">&quot;file:///&quot;</span>)
232
+ 156: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">converted_uri</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^file:/i</span>
233
+ 157: <span class="ruby-comment cmt"># Adjust windows-style uris</span>
234
+ 158: <span class="ruby-identifier">converted_uri</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/^file:\/\/\/([a-zA-Z])\|/i</span>, <span class="ruby-value str">'file:///\1:'</span>)
235
+ 159: <span class="ruby-identifier">converted_uri</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/\\/</span>, <span class="ruby-value str">'/'</span>)
236
+ 160: <span class="ruby-identifier">converted_uri</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">converted_uri</span>).<span class="ruby-identifier">normalize</span>
237
+ 161: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">converted_uri</span>.<span class="ruby-identifier">path</span>) <span class="ruby-operator">&amp;&amp;</span>
238
+ 162: <span class="ruby-constant">File</span>.<span class="ruby-identifier">stat</span>(<span class="ruby-identifier">converted_uri</span>.<span class="ruby-identifier">path</span>).<span class="ruby-identifier">directory?</span>
239
+ 163: <span class="ruby-identifier">converted_uri</span>.<span class="ruby-identifier">path</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/\/$/</span>, <span class="ruby-value str">&quot;&quot;</span>)
240
+ 164: <span class="ruby-identifier">converted_uri</span>.<span class="ruby-identifier">path</span> = <span class="ruby-identifier">converted_uri</span>.<span class="ruby-identifier">path</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'/'</span>
241
+ 165: <span class="ruby-keyword kw">end</span>
242
+ 166: <span class="ruby-keyword kw">else</span>
243
+ 167: <span class="ruby-identifier">converted_uri</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">converted_uri</span>)
244
+ 168: <span class="ruby-keyword kw">end</span>
245
+ 169:
246
+ 170: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">converted_uri</span>
247
+ 171: <span class="ruby-keyword kw">end</span>
247
248
  </pre>
248
249
  </div>
249
250
  </div>
250
251
  </div>
251
252
 
252
- <div id="method-M000008" class="method-detail">
253
- <a name="M000008"></a>
253
+ <div id="method-M000009" class="method-detail">
254
+ <a name="M000009"></a>
254
255
 
255
256
  <div class="method-heading">
256
- <a href="#M000008" class="method-signature">
257
+ <a href="#M000009" class="method-signature">
257
258
  <span class="method-name">encode</span><span class="method-args">(uri)</span>
258
259
  </a>
259
260
  </div>
@@ -264,41 +265,41 @@ Percent encodes any special characters in the <a href="URI.html">URI</a>.
264
265
  This method does not take IRIs or IDNs into account.
265
266
  </p>
266
267
  <p><a class="source-toggle" href="#"
267
- onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
268
- <div class="method-source-code" id="M000008-source">
268
+ onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
269
+ <div class="method-source-code" id="M000009-source">
269
270
  <pre>
270
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 334</span>
271
- 334: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">encode</span>(<span class="ruby-identifier">uri</span>)
272
- 335: <span class="ruby-identifier">uri_object</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-keyword kw">self</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">uri</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">to_s</span>)
273
- 336: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span>.<span class="ruby-identifier">new</span>(
274
- 337: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">encode_segment</span>(<span class="ruby-identifier">uri_object</span>.<span class="ruby-identifier">scheme</span>,
275
- 338: <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">CharacterClasses</span><span class="ruby-operator">::</span><span class="ruby-constant">SCHEME</span>),
276
- 339: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">encode_segment</span>(<span class="ruby-identifier">uri_object</span>.<span class="ruby-identifier">user</span>,
277
- 340: <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">CharacterClasses</span><span class="ruby-operator">::</span><span class="ruby-constant">AUTHORITY</span>),
278
- 341: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">encode_segment</span>(<span class="ruby-identifier">uri_object</span>.<span class="ruby-identifier">password</span>,
279
- 342: <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">CharacterClasses</span><span class="ruby-operator">::</span><span class="ruby-constant">AUTHORITY</span>),
280
- 343: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">encode_segment</span>(<span class="ruby-identifier">uri_object</span>.<span class="ruby-identifier">host</span>,
281
- 344: <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">CharacterClasses</span><span class="ruby-operator">::</span><span class="ruby-constant">AUTHORITY</span>),
282
- 345: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">encode_segment</span>(<span class="ruby-identifier">uri_object</span>.<span class="ruby-identifier">specified_port</span>,
283
- 346: <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">CharacterClasses</span><span class="ruby-operator">::</span><span class="ruby-constant">AUTHORITY</span>),
284
- 347: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">encode_segment</span>(<span class="ruby-identifier">uri_object</span>.<span class="ruby-identifier">path</span>,
285
- 348: <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">CharacterClasses</span><span class="ruby-operator">::</span><span class="ruby-constant">PATH</span>),
286
- 349: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">encode_segment</span>(<span class="ruby-identifier">uri_object</span>.<span class="ruby-identifier">query</span>,
287
- 350: <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">CharacterClasses</span><span class="ruby-operator">::</span><span class="ruby-constant">QUERY</span>),
288
- 351: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">encode_segment</span>(<span class="ruby-identifier">uri_object</span>.<span class="ruby-identifier">fragment</span>,
289
- 352: <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">CharacterClasses</span><span class="ruby-operator">::</span><span class="ruby-constant">FRAGMENT</span>)
290
- 353: ).<span class="ruby-identifier">to_s</span>
291
- 354: <span class="ruby-keyword kw">end</span>
271
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 354</span>
272
+ 354: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">encode</span>(<span class="ruby-identifier">uri</span>)
273
+ 355: <span class="ruby-identifier">uri_object</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-keyword kw">self</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">uri</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">to_s</span>)
274
+ 356: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span>.<span class="ruby-identifier">new</span>(
275
+ 357: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">encode_segment</span>(<span class="ruby-identifier">uri_object</span>.<span class="ruby-identifier">scheme</span>,
276
+ 358: <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">CharacterClasses</span><span class="ruby-operator">::</span><span class="ruby-constant">SCHEME</span>),
277
+ 359: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">encode_segment</span>(<span class="ruby-identifier">uri_object</span>.<span class="ruby-identifier">user</span>,
278
+ 360: <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">CharacterClasses</span><span class="ruby-operator">::</span><span class="ruby-constant">AUTHORITY</span>),
279
+ 361: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">encode_segment</span>(<span class="ruby-identifier">uri_object</span>.<span class="ruby-identifier">password</span>,
280
+ 362: <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">CharacterClasses</span><span class="ruby-operator">::</span><span class="ruby-constant">AUTHORITY</span>),
281
+ 363: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">encode_segment</span>(<span class="ruby-identifier">uri_object</span>.<span class="ruby-identifier">host</span>,
282
+ 364: <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">CharacterClasses</span><span class="ruby-operator">::</span><span class="ruby-constant">AUTHORITY</span>),
283
+ 365: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">encode_segment</span>(<span class="ruby-identifier">uri_object</span>.<span class="ruby-identifier">specified_port</span>,
284
+ 366: <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">CharacterClasses</span><span class="ruby-operator">::</span><span class="ruby-constant">AUTHORITY</span>),
285
+ 367: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">encode_segment</span>(<span class="ruby-identifier">uri_object</span>.<span class="ruby-identifier">path</span>,
286
+ 368: <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">CharacterClasses</span><span class="ruby-operator">::</span><span class="ruby-constant">PATH</span>),
287
+ 369: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">encode_segment</span>(<span class="ruby-identifier">uri_object</span>.<span class="ruby-identifier">query</span>,
288
+ 370: <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">CharacterClasses</span><span class="ruby-operator">::</span><span class="ruby-constant">QUERY</span>),
289
+ 371: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">encode_segment</span>(<span class="ruby-identifier">uri_object</span>.<span class="ruby-identifier">fragment</span>,
290
+ 372: <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">CharacterClasses</span><span class="ruby-operator">::</span><span class="ruby-constant">FRAGMENT</span>)
291
+ 373: ).<span class="ruby-identifier">to_s</span>
292
+ 374: <span class="ruby-keyword kw">end</span>
292
293
  </pre>
293
294
  </div>
294
295
  </div>
295
296
  </div>
296
297
 
297
- <div id="method-M000006" class="method-detail">
298
- <a name="M000006"></a>
298
+ <div id="method-M000007" class="method-detail">
299
+ <a name="M000007"></a>
299
300
 
300
301
  <div class="method-heading">
301
- <a href="#M000006" class="method-signature">
302
+ <a href="#M000007" class="method-signature">
302
303
  <span class="method-name">encode_segment</span><span class="method-args">(segment, character_class= Addressable::URI::CharacterClasses::RESERVED + Addressable::URI::CharacterClasses::UNRESERVED)</span>
303
304
  </a>
304
305
  </div>
@@ -322,30 +323,30 @@ An example:
322
323
  =&gt; &quot;simple%2Dex%61mple&quot;
323
324
  </pre>
324
325
  <p><a class="source-toggle" href="#"
325
- onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
326
- <div class="method-source-code" id="M000006-source">
326
+ onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
327
+ <div class="method-source-code" id="M000007-source">
327
328
  <pre>
328
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 312</span>
329
- 312: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">encode_segment</span>(<span class="ruby-identifier">segment</span>, <span class="ruby-identifier">character_class</span>=
330
- 313: <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">CharacterClasses</span><span class="ruby-operator">::</span><span class="ruby-constant">RESERVED</span> <span class="ruby-operator">+</span>
331
- 314: <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">CharacterClasses</span><span class="ruby-operator">::</span><span class="ruby-constant">UNRESERVED</span>)
332
- 315: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">segment</span>.<span class="ruby-identifier">nil?</span>
333
- 316: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">segment</span>.<span class="ruby-identifier">gsub</span>(
334
- 317: <span class="ruby-node">/[^#{character_class}]/</span>
335
- 318: ) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">sequence</span><span class="ruby-operator">|</span>
336
- 319: (<span class="ruby-value str">&quot;%&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">sequence</span>.<span class="ruby-identifier">unpack</span>(<span class="ruby-value str">'C'</span>)[<span class="ruby-value">0</span>].<span class="ruby-identifier">to_s</span>(<span class="ruby-value">16</span>).<span class="ruby-identifier">upcase</span>)
337
- 320: <span class="ruby-keyword kw">end</span>
338
- 321: <span class="ruby-keyword kw">end</span>
329
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 332</span>
330
+ 332: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">encode_segment</span>(<span class="ruby-identifier">segment</span>, <span class="ruby-identifier">character_class</span>=
331
+ 333: <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">CharacterClasses</span><span class="ruby-operator">::</span><span class="ruby-constant">RESERVED</span> <span class="ruby-operator">+</span>
332
+ 334: <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">CharacterClasses</span><span class="ruby-operator">::</span><span class="ruby-constant">UNRESERVED</span>)
333
+ 335: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">segment</span>.<span class="ruby-identifier">nil?</span>
334
+ 336: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">segment</span>.<span class="ruby-identifier">gsub</span>(
335
+ 337: <span class="ruby-node">/[^#{character_class}]/</span>
336
+ 338: ) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">sequence</span><span class="ruby-operator">|</span>
337
+ 339: (<span class="ruby-value str">&quot;%&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">sequence</span>.<span class="ruby-identifier">unpack</span>(<span class="ruby-value str">'C'</span>)[<span class="ruby-value">0</span>].<span class="ruby-identifier">to_s</span>(<span class="ruby-value">16</span>).<span class="ruby-identifier">upcase</span>)
338
+ 340: <span class="ruby-keyword kw">end</span>
339
+ 341: <span class="ruby-keyword kw">end</span>
339
340
  </pre>
340
341
  </div>
341
342
  </div>
342
343
  </div>
343
344
 
344
- <div id="method-M000003" class="method-detail">
345
- <a name="M000003"></a>
345
+ <div id="method-M000004" class="method-detail">
346
+ <a name="M000004"></a>
346
347
 
347
348
  <div class="method-heading">
348
- <a href="#M000003" class="method-signature">
349
+ <a href="#M000004" class="method-signature">
349
350
  <span class="method-name">expand_template</span><span class="method-args">(pattern, mapping, processor=nil)</span>
350
351
  </a>
351
352
  </div>
@@ -386,47 +387,47 @@ An example:
386
387
  =&gt; &quot;http://example.com/search/an+example+search+query/&quot;
387
388
  </pre>
388
389
  <p><a class="source-toggle" href="#"
389
- onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
390
- <div class="method-source-code" id="M000003-source">
390
+ onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
391
+ <div class="method-source-code" id="M000004-source">
391
392
  <pre>
392
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 182</span>
393
- 182: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">expand_template</span>(<span class="ruby-identifier">pattern</span>, <span class="ruby-identifier">mapping</span>, <span class="ruby-identifier">processor</span>=<span class="ruby-keyword kw">nil</span>)
394
- 183: <span class="ruby-identifier">result</span> = <span class="ruby-identifier">pattern</span>.<span class="ruby-identifier">dup</span>
395
- 184: <span class="ruby-keyword kw">for</span> <span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span> <span class="ruby-keyword kw">in</span> <span class="ruby-identifier">mapping</span>
396
- 185: <span class="ruby-identifier">transformed_value</span> = <span class="ruby-identifier">value</span>
397
- 186: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">processor</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
398
- 187: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">processor</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:validate</span>)
399
- 188: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">processor</span>.<span class="ruby-identifier">validate</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span>)
400
- 189: <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidTemplateValue</span>,
401
- 190: <span class="ruby-node">&quot;(#{name}, #{value}) is an invalid template value.&quot;</span>
402
- 191: <span class="ruby-keyword kw">end</span>
403
- 192: <span class="ruby-keyword kw">end</span>
404
- 193: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">processor</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:transform</span>)
405
- 194: <span class="ruby-identifier">transformed_value</span> = <span class="ruby-identifier">processor</span>.<span class="ruby-identifier">transform</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span>)
406
- 195: <span class="ruby-keyword kw">end</span>
407
- 196: <span class="ruby-keyword kw">end</span>
408
- 197:
409
- 198: <span class="ruby-comment cmt"># Handle percent escaping</span>
410
- 199: <span class="ruby-identifier">transformed_value</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">encode_segment</span>(<span class="ruby-identifier">transformed_value</span>,
411
- 200: <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">CharacterClasses</span><span class="ruby-operator">::</span><span class="ruby-constant">RESERVED</span> <span class="ruby-operator">+</span>
412
- 201: <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">CharacterClasses</span><span class="ruby-operator">::</span><span class="ruby-constant">UNRESERVED</span>)
413
- 202:
414
- 203: <span class="ruby-identifier">result</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-node">/\{#{Regexp.escape(name)}\}/</span>, <span class="ruby-identifier">transformed_value</span>)
415
- 204: <span class="ruby-keyword kw">end</span>
416
- 205: <span class="ruby-identifier">result</span>.<span class="ruby-identifier">gsub!</span>(
417
- 206: <span class="ruby-node">/\{[#{Addressable::URI::CharacterClasses::UNRESERVED}]+\}/</span>, <span class="ruby-value str">&quot;&quot;</span>)
418
- 207: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">result</span>)
419
- 208: <span class="ruby-keyword kw">end</span>
393
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 202</span>
394
+ 202: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">expand_template</span>(<span class="ruby-identifier">pattern</span>, <span class="ruby-identifier">mapping</span>, <span class="ruby-identifier">processor</span>=<span class="ruby-keyword kw">nil</span>)
395
+ 203: <span class="ruby-identifier">result</span> = <span class="ruby-identifier">pattern</span>.<span class="ruby-identifier">dup</span>
396
+ 204: <span class="ruby-keyword kw">for</span> <span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span> <span class="ruby-keyword kw">in</span> <span class="ruby-identifier">mapping</span>
397
+ 205: <span class="ruby-identifier">transformed_value</span> = <span class="ruby-identifier">value</span>
398
+ 206: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">processor</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
399
+ 207: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">processor</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:validate</span>)
400
+ 208: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">processor</span>.<span class="ruby-identifier">validate</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span>)
401
+ 209: <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidTemplateValue</span>,
402
+ 210: <span class="ruby-node">&quot;(#{name}, #{value}) is an invalid template value.&quot;</span>
403
+ 211: <span class="ruby-keyword kw">end</span>
404
+ 212: <span class="ruby-keyword kw">end</span>
405
+ 213: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">processor</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:transform</span>)
406
+ 214: <span class="ruby-identifier">transformed_value</span> = <span class="ruby-identifier">processor</span>.<span class="ruby-identifier">transform</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span>)
407
+ 215: <span class="ruby-keyword kw">end</span>
408
+ 216: <span class="ruby-keyword kw">end</span>
409
+ 217:
410
+ 218: <span class="ruby-comment cmt"># Handle percent escaping</span>
411
+ 219: <span class="ruby-identifier">transformed_value</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">encode_segment</span>(<span class="ruby-identifier">transformed_value</span>,
412
+ 220: <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">CharacterClasses</span><span class="ruby-operator">::</span><span class="ruby-constant">RESERVED</span> <span class="ruby-operator">+</span>
413
+ 221: <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">CharacterClasses</span><span class="ruby-operator">::</span><span class="ruby-constant">UNRESERVED</span>)
414
+ 222:
415
+ 223: <span class="ruby-identifier">result</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-node">/\{#{Regexp.escape(name)}\}/</span>, <span class="ruby-identifier">transformed_value</span>)
416
+ 224: <span class="ruby-keyword kw">end</span>
417
+ 225: <span class="ruby-identifier">result</span>.<span class="ruby-identifier">gsub!</span>(
418
+ 226: <span class="ruby-node">/\{[#{Addressable::URI::CharacterClasses::UNRESERVED}]+\}/</span>, <span class="ruby-value str">&quot;&quot;</span>)
419
+ 227: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">result</span>)
420
+ 228: <span class="ruby-keyword kw">end</span>
420
421
  </pre>
421
422
  </div>
422
423
  </div>
423
424
  </div>
424
425
 
425
- <div id="method-M000010" class="method-detail">
426
- <a name="M000010"></a>
426
+ <div id="method-M000011" class="method-detail">
427
+ <a name="M000011"></a>
427
428
 
428
429
  <div class="method-heading">
429
- <a href="#M000010" class="method-signature">
430
+ <a href="#M000011" class="method-signature">
430
431
  <span class="method-name">extract</span><span class="method-args">(text, options={})</span>
431
432
  </a>
432
433
  </div>
@@ -436,71 +437,131 @@ An example:
436
437
  Extracts uris from an arbitrary body of text.
437
438
  </p>
438
439
  <p><a class="source-toggle" href="#"
439
- onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
440
- <div class="method-source-code" id="M000010-source">
440
+ onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
441
+ <div class="method-source-code" id="M000011-source">
441
442
  <pre>
442
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 400</span>
443
- 400: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">extract</span>(<span class="ruby-identifier">text</span>, <span class="ruby-identifier">options</span>={})
444
- 401: <span class="ruby-identifier">defaults</span> = {<span class="ruby-identifier">:base</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">:parse</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">false</span>}
445
- 402: <span class="ruby-identifier">options</span> = <span class="ruby-identifier">defaults</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">options</span>)
446
- 403: <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidOptionError</span> <span class="ruby-keyword kw">unless</span> (<span class="ruby-identifier">options</span>.<span class="ruby-identifier">keys</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">defaults</span>.<span class="ruby-identifier">keys</span>).<span class="ruby-identifier">empty?</span>
447
- 404: <span class="ruby-comment cmt"># This regular expression needs to be less forgiving or else it would</span>
448
- 405: <span class="ruby-comment cmt"># match virtually all text. Which isn't exactly what we're going for.</span>
449
- 406: <span class="ruby-identifier">extract_regex</span> = <span class="ruby-regexp re">/((([a-z\+]+):)[^ \n\&lt;\&gt;\&quot;\\]+[\w\/])/</span>
450
- 407: <span class="ruby-identifier">extracted_uris</span> =
451
- 408: <span class="ruby-identifier">text</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-identifier">extract_regex</span>).<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">match</span><span class="ruby-operator">|</span> <span class="ruby-identifier">match</span>[<span class="ruby-value">0</span>] }
452
- 409: <span class="ruby-identifier">sgml_extract_regex</span> = <span class="ruby-regexp re">/&lt;[^&gt;]+href=\&quot;([^\&quot;]+?)\&quot;[^&gt;]*&gt;/</span>
453
- 410: <span class="ruby-identifier">sgml_extracted_uris</span> =
454
- 411: <span class="ruby-identifier">text</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-identifier">sgml_extract_regex</span>).<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">match</span><span class="ruby-operator">|</span> <span class="ruby-identifier">match</span>[<span class="ruby-value">0</span>] }
455
- 412: <span class="ruby-identifier">extracted_uris</span>.<span class="ruby-identifier">concat</span>(<span class="ruby-identifier">sgml_extracted_uris</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">extracted_uris</span>)
456
- 413: <span class="ruby-identifier">textile_extract_regex</span> = <span class="ruby-regexp re">/\&quot;.+?\&quot;:([^ ]+\/[^ ]+)[ \,\.\;\:\?\!\&lt;\&gt;\&quot;]/i</span>
457
- 414: <span class="ruby-identifier">textile_extracted_uris</span> =
458
- 415: <span class="ruby-identifier">text</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-identifier">textile_extract_regex</span>).<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">match</span><span class="ruby-operator">|</span> <span class="ruby-identifier">match</span>[<span class="ruby-value">0</span>] }
459
- 416: <span class="ruby-identifier">extracted_uris</span>.<span class="ruby-identifier">concat</span>(<span class="ruby-identifier">textile_extracted_uris</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">extracted_uris</span>)
460
- 417: <span class="ruby-identifier">parsed_uris</span> = []
461
- 418: <span class="ruby-identifier">base_uri</span> = <span class="ruby-keyword kw">nil</span>
462
- 419: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:base</span>] <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
463
- 420: <span class="ruby-identifier">base_uri</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:base</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:base</span>].<span class="ruby-identifier">kind_of?</span>(<span class="ruby-keyword kw">self</span>)
464
- 421: <span class="ruby-identifier">base_uri</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:base</span>].<span class="ruby-identifier">to_s</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">base_uri</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
465
- 422: <span class="ruby-keyword kw">end</span>
466
- 423: <span class="ruby-keyword kw">for</span> <span class="ruby-identifier">uri_string</span> <span class="ruby-keyword kw">in</span> <span class="ruby-identifier">extracted_uris</span>
467
- 424: <span class="ruby-keyword kw">begin</span>
468
- 425: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">base_uri</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
469
- 426: <span class="ruby-identifier">parsed_uris</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">uri_string</span>)
470
- 427: <span class="ruby-keyword kw">else</span>
471
- 428: <span class="ruby-identifier">parsed_uris</span> <span class="ruby-operator">&lt;&lt;</span> (<span class="ruby-identifier">base_uri</span> <span class="ruby-operator">+</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">uri_string</span>))
472
- 429: <span class="ruby-keyword kw">end</span>
473
- 430: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span>
474
- 431: <span class="ruby-keyword kw">nil</span>
475
- 432: <span class="ruby-keyword kw">end</span>
476
- 433: <span class="ruby-keyword kw">end</span>
477
- 434: <span class="ruby-identifier">parsed_uris</span>.<span class="ruby-identifier">reject!</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">uri</span><span class="ruby-operator">|</span>
478
- 435: (<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/T\d+/</span> <span class="ruby-operator">||</span>
479
- 436: <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;xmlns&quot;</span> <span class="ruby-operator">||</span>
480
- 437: <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;xml&quot;</span> <span class="ruby-operator">||</span>
481
- 438: <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;thr&quot;</span> <span class="ruby-operator">||</span>
482
- 439: <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;this&quot;</span> <span class="ruby-operator">||</span>
483
- 440: <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;float&quot;</span> <span class="ruby-operator">||</span>
484
- 441: <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;user&quot;</span> <span class="ruby-operator">||</span>
485
- 442: <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;username&quot;</span> <span class="ruby-operator">||</span>
486
- 443: <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;out&quot;</span>)
487
- 444: <span class="ruby-keyword kw">end</span>
488
- 445: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:parse</span>]
489
- 446: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">parsed_uris</span>
490
- 447: <span class="ruby-keyword kw">else</span>
491
- 448: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">parsed_uris</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">uri</span><span class="ruby-operator">|</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">to_s</span> }
492
- 449: <span class="ruby-keyword kw">end</span>
493
- 450: <span class="ruby-keyword kw">end</span>
443
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 420</span>
444
+ 420: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">extract</span>(<span class="ruby-identifier">text</span>, <span class="ruby-identifier">options</span>={})
445
+ 421: <span class="ruby-identifier">defaults</span> = {<span class="ruby-identifier">:base</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">:parse</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">false</span>}
446
+ 422: <span class="ruby-identifier">options</span> = <span class="ruby-identifier">defaults</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">options</span>)
447
+ 423: <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidOptionError</span> <span class="ruby-keyword kw">unless</span> (<span class="ruby-identifier">options</span>.<span class="ruby-identifier">keys</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">defaults</span>.<span class="ruby-identifier">keys</span>).<span class="ruby-identifier">empty?</span>
448
+ 424: <span class="ruby-comment cmt"># This regular expression needs to be less forgiving or else it would</span>
449
+ 425: <span class="ruby-comment cmt"># match virtually all text. Which isn't exactly what we're going for.</span>
450
+ 426: <span class="ruby-identifier">extract_regex</span> = <span class="ruby-regexp re">/((([a-z\+]+):)[^ \n\&lt;\&gt;\&quot;\\]+[\w\/])/</span>
451
+ 427: <span class="ruby-identifier">extracted_uris</span> =
452
+ 428: <span class="ruby-identifier">text</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-identifier">extract_regex</span>).<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">match</span><span class="ruby-operator">|</span> <span class="ruby-identifier">match</span>[<span class="ruby-value">0</span>] }
453
+ 429: <span class="ruby-identifier">sgml_extract_regex</span> = <span class="ruby-regexp re">/&lt;[^&gt;]+href=\&quot;([^\&quot;]+?)\&quot;[^&gt;]*&gt;/</span>
454
+ 430: <span class="ruby-identifier">sgml_extracted_uris</span> =
455
+ 431: <span class="ruby-identifier">text</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-identifier">sgml_extract_regex</span>).<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">match</span><span class="ruby-operator">|</span> <span class="ruby-identifier">match</span>[<span class="ruby-value">0</span>] }
456
+ 432: <span class="ruby-identifier">extracted_uris</span>.<span class="ruby-identifier">concat</span>(<span class="ruby-identifier">sgml_extracted_uris</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">extracted_uris</span>)
457
+ 433: <span class="ruby-identifier">textile_extract_regex</span> = <span class="ruby-regexp re">/\&quot;.+?\&quot;:([^ ]+\/[^ ]+)[ \,\.\;\:\?\!\&lt;\&gt;\&quot;]/i</span>
458
+ 434: <span class="ruby-identifier">textile_extracted_uris</span> =
459
+ 435: <span class="ruby-identifier">text</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-identifier">textile_extract_regex</span>).<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">match</span><span class="ruby-operator">|</span> <span class="ruby-identifier">match</span>[<span class="ruby-value">0</span>] }
460
+ 436: <span class="ruby-identifier">extracted_uris</span>.<span class="ruby-identifier">concat</span>(<span class="ruby-identifier">textile_extracted_uris</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">extracted_uris</span>)
461
+ 437: <span class="ruby-identifier">parsed_uris</span> = []
462
+ 438: <span class="ruby-identifier">base_uri</span> = <span class="ruby-keyword kw">nil</span>
463
+ 439: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:base</span>] <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
464
+ 440: <span class="ruby-identifier">base_uri</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:base</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:base</span>].<span class="ruby-identifier">kind_of?</span>(<span class="ruby-keyword kw">self</span>)
465
+ 441: <span class="ruby-identifier">base_uri</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:base</span>].<span class="ruby-identifier">to_s</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">base_uri</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
466
+ 442: <span class="ruby-keyword kw">end</span>
467
+ 443: <span class="ruby-keyword kw">for</span> <span class="ruby-identifier">uri_string</span> <span class="ruby-keyword kw">in</span> <span class="ruby-identifier">extracted_uris</span>
468
+ 444: <span class="ruby-keyword kw">begin</span>
469
+ 445: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">base_uri</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
470
+ 446: <span class="ruby-identifier">parsed_uris</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">uri_string</span>)
471
+ 447: <span class="ruby-keyword kw">else</span>
472
+ 448: <span class="ruby-identifier">parsed_uris</span> <span class="ruby-operator">&lt;&lt;</span> (<span class="ruby-identifier">base_uri</span> <span class="ruby-operator">+</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">uri_string</span>))
473
+ 449: <span class="ruby-keyword kw">end</span>
474
+ 450: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span>
475
+ 451: <span class="ruby-keyword kw">nil</span>
476
+ 452: <span class="ruby-keyword kw">end</span>
477
+ 453: <span class="ruby-keyword kw">end</span>
478
+ 454: <span class="ruby-identifier">parsed_uris</span>.<span class="ruby-identifier">reject!</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">uri</span><span class="ruby-operator">|</span>
479
+ 455: (<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/T\d+/</span> <span class="ruby-operator">||</span>
480
+ 456: <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;xmlns&quot;</span> <span class="ruby-operator">||</span>
481
+ 457: <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;xml&quot;</span> <span class="ruby-operator">||</span>
482
+ 458: <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;thr&quot;</span> <span class="ruby-operator">||</span>
483
+ 459: <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;this&quot;</span> <span class="ruby-operator">||</span>
484
+ 460: <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;float&quot;</span> <span class="ruby-operator">||</span>
485
+ 461: <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;user&quot;</span> <span class="ruby-operator">||</span>
486
+ 462: <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;username&quot;</span> <span class="ruby-operator">||</span>
487
+ 463: <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;out&quot;</span>)
488
+ 464: <span class="ruby-keyword kw">end</span>
489
+ 465: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:parse</span>]
490
+ 466: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">parsed_uris</span>
491
+ 467: <span class="ruby-keyword kw">else</span>
492
+ 468: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">parsed_uris</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">uri</span><span class="ruby-operator">|</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">to_s</span> }
493
+ 469: <span class="ruby-keyword kw">end</span>
494
+ 470: <span class="ruby-keyword kw">end</span>
494
495
  </pre>
495
496
  </div>
496
497
  </div>
497
498
  </div>
498
499
 
499
- <div id="method-M000024" class="method-detail">
500
- <a name="M000024"></a>
500
+ <div id="method-M000002" class="method-detail">
501
+ <a name="M000002"></a>
501
502
 
502
503
  <div class="method-heading">
503
- <a href="#M000024" class="method-signature">
504
+ <a href="#M000002" class="method-signature">
505
+ <span class="method-name">heuristic_parse</span><span class="method-args">(input, hints={})</span>
506
+ </a>
507
+ </div>
508
+
509
+ <div class="method-description">
510
+ <p>
511
+ Converts an input to a <a href="URI.html">URI</a>. The input does not have
512
+ to be a valid <a href="URI.html">URI</a> &#8212; the method will use
513
+ heuristics to guess what <a href="URI.html">URI</a> was intended. This is
514
+ not standards compliant, merely <a
515
+ href="URI.html#M000015">user</a>-friendly.
516
+ </p>
517
+ <p><a class="source-toggle" href="#"
518
+ onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
519
+ <div class="method-source-code" id="M000002-source">
520
+ <pre>
521
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 107</span>
522
+ 107: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">heuristic_parse</span>(<span class="ruby-identifier">input</span>, <span class="ruby-identifier">hints</span>={})
523
+ 108: <span class="ruby-identifier">input</span> = <span class="ruby-identifier">input</span>.<span class="ruby-identifier">dup</span>
524
+ 109: <span class="ruby-identifier">hints</span> = {
525
+ 110: <span class="ruby-identifier">:scheme</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;http&quot;</span>
526
+ 111: }.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">hints</span>)
527
+ 112: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">input</span>
528
+ 113: <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">/^http:\/+/</span>
529
+ 114: <span class="ruby-identifier">input</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/^http:\/+/</span>, <span class="ruby-value str">&quot;http://&quot;</span>)
530
+ 115: <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">/^feed:\/+http:\/+/</span>
531
+ 116: <span class="ruby-identifier">input</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/^feed:\/+http:\/+/</span>, <span class="ruby-value str">&quot;feed:http://&quot;</span>)
532
+ 117: <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">/^feed:\/+/</span>
533
+ 118: <span class="ruby-identifier">input</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/^feed:\/+/</span>, <span class="ruby-value str">&quot;feed://&quot;</span>)
534
+ 119: <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">/^file:\/+/</span>
535
+ 120: <span class="ruby-identifier">input</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/^file:\/+/</span>, <span class="ruby-value str">&quot;file:///&quot;</span>)
536
+ 121: <span class="ruby-keyword kw">end</span>
537
+ 122: <span class="ruby-identifier">parsed</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">input</span>)
538
+ 123: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^[^\/?#\.]+\.[^\/?#]+$/</span>
539
+ 124: <span class="ruby-identifier">parsed</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">hints</span>[<span class="ruby-identifier">:scheme</span>] <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;://&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">input</span>)
540
+ 125: <span class="ruby-keyword kw">end</span>
541
+ 126: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">authority</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
542
+ 127: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">path</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^[^\/]+\./</span>
543
+ 128: <span class="ruby-identifier">new_host</span> = <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">path</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/^([^\/]+\.[^\/]*)/</span>).<span class="ruby-identifier">flatten</span>[<span class="ruby-value">0</span>]
544
+ 129: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">new_host</span>
545
+ 130: <span class="ruby-identifier">new_path</span> = <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">path</span>.<span class="ruby-identifier">gsub</span>(
546
+ 131: <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">&quot;^&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">escape</span>(<span class="ruby-identifier">new_host</span>)), <span class="ruby-value str">&quot;&quot;</span>)
547
+ 132: <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">host</span> = <span class="ruby-identifier">new_host</span>
548
+ 133: <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">path</span> = <span class="ruby-identifier">new_path</span>
549
+ 134: <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">scheme</span> = <span class="ruby-identifier">hints</span>[<span class="ruby-identifier">:scheme</span>]
550
+ 135: <span class="ruby-keyword kw">end</span>
551
+ 136: <span class="ruby-keyword kw">end</span>
552
+ 137: <span class="ruby-keyword kw">end</span>
553
+ 138: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">parsed</span>
554
+ 139: <span class="ruby-keyword kw">end</span>
555
+ </pre>
556
+ </div>
557
+ </div>
558
+ </div>
559
+
560
+ <div id="method-M000025" class="method-detail">
561
+ <a name="M000025"></a>
562
+
563
+ <div class="method-heading">
564
+ <a href="#M000025" class="method-signature">
504
565
  <span class="method-name">ip_based_schemes</span><span class="method-args">()</span>
505
566
  </a>
506
567
  </div>
@@ -509,30 +570,30 @@ Extracts uris from an arbitrary body of text.
509
570
  <p>
510
571
  Returns an array of known ip-based schemes. These schemes typically use a
511
572
  similar <a href="URI.html">URI</a> form: //&lt;<a
512
- href="URI.html#M000014">user</a>&gt;:&lt;<a
513
- href="URI.html#M000016">password</a>&gt;@&lt;<a
514
- href="URI.html#M000020">host</a>&gt;:&lt;<a
515
- href="URI.html#M000026">port</a>&gt;/&lt;url-<a
516
- href="URI.html#M000029">path</a>&gt;
573
+ href="URI.html#M000015">user</a>&gt;:&lt;<a
574
+ href="URI.html#M000017">password</a>&gt;@&lt;<a
575
+ href="URI.html#M000021">host</a>&gt;:&lt;<a
576
+ href="URI.html#M000027">port</a>&gt;/&lt;url-<a
577
+ href="URI.html#M000030">path</a>&gt;
517
578
  </p>
518
579
  <p><a class="source-toggle" href="#"
519
- onclick="toggleCode('M000024-source');return false;">[Source]</a></p>
520
- <div class="method-source-code" id="M000024-source">
580
+ onclick="toggleCode('M000025-source');return false;">[Source]</a></p>
581
+ <div class="method-source-code" id="M000025-source">
521
582
  <pre>
522
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 625</span>
523
- 625: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">ip_based_schemes</span>
524
- 626: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">scheme_mapping</span>.<span class="ruby-identifier">keys</span>
525
- 627: <span class="ruby-keyword kw">end</span>
583
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 643</span>
584
+ 643: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">ip_based_schemes</span>
585
+ 644: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">scheme_mapping</span>.<span class="ruby-identifier">keys</span>
586
+ 645: <span class="ruby-keyword kw">end</span>
526
587
  </pre>
527
588
  </div>
528
589
  </div>
529
590
  </div>
530
591
 
531
- <div id="method-M000005" class="method-detail">
532
- <a name="M000005"></a>
592
+ <div id="method-M000006" class="method-detail">
593
+ <a name="M000006"></a>
533
594
 
534
595
  <div class="method-heading">
535
- <a href="#M000005" class="method-signature">
596
+ <a href="#M000006" class="method-signature">
536
597
  <span class="method-name">join</span><span class="method-args">(*uris)</span>
537
598
  </a>
538
599
  </div>
@@ -542,75 +603,74 @@ href="URI.html#M000029">path</a>&gt;
542
603
  Joins several uris together.
543
604
  </p>
544
605
  <p><a class="source-toggle" href="#"
545
- onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
546
- <div class="method-source-code" id="M000005-source">
606
+ onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
607
+ <div class="method-source-code" id="M000006-source">
547
608
  <pre>
548
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 289</span>
549
- 289: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">join</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">uris</span>)
550
- 290: <span class="ruby-identifier">uri_objects</span> = <span class="ruby-identifier">uris</span>.<span class="ruby-identifier">collect</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">uri</span><span class="ruby-operator">|</span>
551
- 291: <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-keyword kw">self</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">uri</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">to_s</span>)
552
- 292: <span class="ruby-keyword kw">end</span>
553
- 293: <span class="ruby-identifier">result</span> = <span class="ruby-identifier">uri_objects</span>.<span class="ruby-identifier">shift</span>.<span class="ruby-identifier">dup</span>
554
- 294: <span class="ruby-keyword kw">for</span> <span class="ruby-identifier">uri</span> <span class="ruby-keyword kw">in</span> <span class="ruby-identifier">uri_objects</span>
555
- 295: <span class="ruby-identifier">result</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-identifier">uri</span>)
556
- 296: <span class="ruby-keyword kw">end</span>
557
- 297: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">result</span>
558
- 298: <span class="ruby-keyword kw">end</span>
609
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 309</span>
610
+ 309: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">join</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">uris</span>)
611
+ 310: <span class="ruby-identifier">uri_objects</span> = <span class="ruby-identifier">uris</span>.<span class="ruby-identifier">collect</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">uri</span><span class="ruby-operator">|</span>
612
+ 311: <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-keyword kw">self</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">uri</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">to_s</span>)
613
+ 312: <span class="ruby-keyword kw">end</span>
614
+ 313: <span class="ruby-identifier">result</span> = <span class="ruby-identifier">uri_objects</span>.<span class="ruby-identifier">shift</span>.<span class="ruby-identifier">dup</span>
615
+ 314: <span class="ruby-keyword kw">for</span> <span class="ruby-identifier">uri</span> <span class="ruby-keyword kw">in</span> <span class="ruby-identifier">uri_objects</span>
616
+ 315: <span class="ruby-identifier">result</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-identifier">uri</span>)
617
+ 316: <span class="ruby-keyword kw">end</span>
618
+ 317: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">result</span>
619
+ 318: <span class="ruby-keyword kw">end</span>
559
620
  </pre>
560
621
  </div>
561
622
  </div>
562
623
  </div>
563
624
 
564
- <div id="method-M000011" class="method-detail">
565
- <a name="M000011"></a>
625
+ <div id="method-M000012" class="method-detail">
626
+ <a name="M000012"></a>
566
627
 
567
628
  <div class="method-heading">
568
- <a href="#M000011" class="method-signature">
629
+ <a href="#M000012" class="method-signature">
569
630
  <span class="method-name">new</span><span class="method-args">(scheme, user, password, host, port, path, query, fragment)</span>
570
631
  </a>
571
632
  </div>
572
633
 
573
634
  <div class="method-description">
574
635
  <p>
575
- Creates a <a href="URI.html#M000011">new</a> uri object from component
636
+ Creates a <a href="URI.html#M000012">new</a> uri object from component
576
637
  parts. Passing nil for any of these parameters is acceptable.
577
638
  </p>
578
639
  <p><a class="source-toggle" href="#"
579
- onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
580
- <div class="method-source-code" id="M000011-source">
640
+ onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
641
+ <div class="method-source-code" id="M000012-source">
581
642
  <pre>
582
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 454</span>
583
- 454: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">scheme</span>, <span class="ruby-identifier">user</span>, <span class="ruby-identifier">password</span>, <span class="ruby-identifier">host</span>, <span class="ruby-identifier">port</span>, <span class="ruby-identifier">path</span>, <span class="ruby-identifier">query</span>, <span class="ruby-identifier">fragment</span>)
584
- 455: <span class="ruby-ivar">@scheme</span> = <span class="ruby-identifier">scheme</span>
585
- 456: <span class="ruby-ivar">@scheme</span> = <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@scheme</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">strip</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;&quot;</span>
586
- 457: <span class="ruby-ivar">@user</span> = <span class="ruby-identifier">user</span>
587
- 458: <span class="ruby-ivar">@password</span> = <span class="ruby-identifier">password</span>
588
- 459: <span class="ruby-ivar">@host</span> = <span class="ruby-identifier">host</span>
589
- 460: <span class="ruby-ivar">@specified_port</span> = <span class="ruby-identifier">port</span>.<span class="ruby-identifier">to_s</span>
590
- 461: <span class="ruby-ivar">@port</span> = <span class="ruby-identifier">port</span>
591
- 462: <span class="ruby-ivar">@port</span> = <span class="ruby-ivar">@port</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@port</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Fixnum</span>)
592
- 463: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@port</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span>(<span class="ruby-ivar">@port</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^\d+$/</span>)
593
- 464: <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidURIError</span>,
594
- 465: <span class="ruby-node">&quot;Invalid port number: #{@port.inspect}&quot;</span>
595
- 466: <span class="ruby-keyword kw">end</span>
596
- 467: <span class="ruby-ivar">@port</span> = <span class="ruby-ivar">@port</span>.<span class="ruby-identifier">to_i</span>
597
- 468: <span class="ruby-ivar">@port</span> = <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@port</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
598
- 469: <span class="ruby-ivar">@path</span> = <span class="ruby-identifier">path</span>
599
- 470: <span class="ruby-ivar">@query</span> = <span class="ruby-identifier">query</span>
600
- 471: <span class="ruby-ivar">@fragment</span> = <span class="ruby-identifier">fragment</span>
601
- 472:
602
- 473: <span class="ruby-identifier">validate</span>()
603
- 474: <span class="ruby-keyword kw">end</span>
643
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 474</span>
644
+ 474: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">scheme</span>, <span class="ruby-identifier">user</span>, <span class="ruby-identifier">password</span>, <span class="ruby-identifier">host</span>, <span class="ruby-identifier">port</span>, <span class="ruby-identifier">path</span>, <span class="ruby-identifier">query</span>, <span class="ruby-identifier">fragment</span>)
645
+ 475: <span class="ruby-ivar">@scheme</span> = <span class="ruby-identifier">scheme</span>
646
+ 476: <span class="ruby-ivar">@scheme</span> = <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@scheme</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">strip</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;&quot;</span>
647
+ 477: <span class="ruby-ivar">@user</span> = <span class="ruby-identifier">user</span>
648
+ 478: <span class="ruby-ivar">@password</span> = <span class="ruby-identifier">password</span>
649
+ 479: <span class="ruby-ivar">@host</span> = <span class="ruby-identifier">host</span>
650
+ 480: <span class="ruby-ivar">@specified_port</span> = <span class="ruby-identifier">port</span>.<span class="ruby-identifier">to_s</span>
651
+ 481: <span class="ruby-ivar">@port</span> = <span class="ruby-identifier">port</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Fixnum</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">port</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">port</span>
652
+ 482: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@port</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span>(<span class="ruby-ivar">@port</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^\d+$/</span>)
653
+ 483: <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidURIError</span>,
654
+ 484: <span class="ruby-node">&quot;Invalid port number: #{@port.inspect}&quot;</span>
655
+ 485: <span class="ruby-keyword kw">end</span>
656
+ 486: <span class="ruby-ivar">@port</span> = <span class="ruby-ivar">@port</span>.<span class="ruby-identifier">to_i</span>
657
+ 487: <span class="ruby-ivar">@port</span> = <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@port</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
658
+ 488: <span class="ruby-ivar">@path</span> = (<span class="ruby-identifier">path</span> <span class="ruby-operator">||</span> <span class="ruby-value str">&quot;&quot;</span>)
659
+ 489: <span class="ruby-ivar">@query</span> = <span class="ruby-identifier">query</span>
660
+ 490: <span class="ruby-ivar">@fragment</span> = <span class="ruby-identifier">fragment</span>
661
+ 491:
662
+ 492: <span class="ruby-identifier">validate</span>()
663
+ 493: <span class="ruby-keyword kw">end</span>
604
664
  </pre>
605
665
  </div>
606
666
  </div>
607
667
  </div>
608
668
 
609
- <div id="method-M000009" class="method-detail">
610
- <a name="M000009"></a>
669
+ <div id="method-M000010" class="method-detail">
670
+ <a name="M000010"></a>
611
671
 
612
672
  <div class="method-heading">
613
- <a href="#M000009" class="method-signature">
673
+ <a href="#M000010" class="method-signature">
614
674
  <span class="method-name">normalized_encode</span><span class="method-args">(uri)</span>
615
675
  </a>
616
676
  </div>
@@ -622,46 +682,46 @@ a hostname are not percent encoded to allow for internationalized domain
622
682
  names.
623
683
  </p>
624
684
  <p><a class="source-toggle" href="#"
625
- onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
626
- <div class="method-source-code" id="M000009-source">
685
+ onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
686
+ <div class="method-source-code" id="M000010-source">
627
687
  <pre>
628
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 362</span>
629
- 362: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">normalized_encode</span>(<span class="ruby-identifier">uri</span>)
630
- 363: <span class="ruby-identifier">uri_object</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-keyword kw">self</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">uri</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">to_s</span>)
631
- 364: <span class="ruby-identifier">segments</span> = {
632
- 365: <span class="ruby-identifier">:scheme</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">unencode_segment</span>(<span class="ruby-identifier">uri_object</span>.<span class="ruby-identifier">scheme</span>),
633
- 366: <span class="ruby-identifier">:user</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">unencode_segment</span>(<span class="ruby-identifier">uri_object</span>.<span class="ruby-identifier">user</span>),
634
- 367: <span class="ruby-identifier">:password</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">unencode_segment</span>(<span class="ruby-identifier">uri_object</span>.<span class="ruby-identifier">password</span>),
635
- 368: <span class="ruby-identifier">:host</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">unencode_segment</span>(<span class="ruby-identifier">uri_object</span>.<span class="ruby-identifier">host</span>),
636
- 369: <span class="ruby-identifier">:port</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">unencode_segment</span>(<span class="ruby-identifier">uri_object</span>.<span class="ruby-identifier">specified_port</span>),
637
- 370: <span class="ruby-identifier">:path</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">unencode_segment</span>(<span class="ruby-identifier">uri_object</span>.<span class="ruby-identifier">path</span>),
638
- 371: <span class="ruby-identifier">:query</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">unencode_segment</span>(<span class="ruby-identifier">uri_object</span>.<span class="ruby-identifier">query</span>),
639
- 372: <span class="ruby-identifier">:fragment</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">unencode_segment</span>(<span class="ruby-identifier">uri_object</span>.<span class="ruby-identifier">fragment</span>)
640
- 373: }
641
- 374: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">IDNA</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">:use_libidn?</span>)
642
- 375: <span class="ruby-identifier">segments</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
643
- 376: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">value</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
644
- 377: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-constant">IDN</span><span class="ruby-operator">::</span><span class="ruby-constant">Stringprep</span>.<span class="ruby-identifier">nfkc_normalize</span>(<span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_s</span>)
645
- 378: <span class="ruby-keyword kw">end</span>
646
- 379: <span class="ruby-keyword kw">end</span>
647
- 380: <span class="ruby-keyword kw">end</span>
648
- 381: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span>.<span class="ruby-identifier">new</span>(
649
- 382: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">encode_segment</span>(<span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:scheme</span>],
650
- 383: <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">CharacterClasses</span><span class="ruby-operator">::</span><span class="ruby-constant">SCHEME</span>),
651
- 384: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">encode_segment</span>(<span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:user</span>],
652
- 385: <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">CharacterClasses</span><span class="ruby-operator">::</span><span class="ruby-constant">AUTHORITY</span>),
653
- 386: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">encode_segment</span>(<span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:password</span>],
654
- 387: <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">CharacterClasses</span><span class="ruby-operator">::</span><span class="ruby-constant">AUTHORITY</span>),
655
- 388: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:host</span>],
656
- 389: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:port</span>],
657
- 390: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">encode_segment</span>(<span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:path</span>],
658
- 391: <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">CharacterClasses</span><span class="ruby-operator">::</span><span class="ruby-constant">PATH</span>),
659
- 392: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">encode_segment</span>(<span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:query</span>],
660
- 393: <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">CharacterClasses</span><span class="ruby-operator">::</span><span class="ruby-constant">QUERY</span>),
661
- 394: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">encode_segment</span>(<span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:fragment</span>],
662
- 395: <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">CharacterClasses</span><span class="ruby-operator">::</span><span class="ruby-constant">FRAGMENT</span>)
663
- 396: ).<span class="ruby-identifier">to_s</span>
664
- 397: <span class="ruby-keyword kw">end</span>
688
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 382</span>
689
+ 382: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">normalized_encode</span>(<span class="ruby-identifier">uri</span>)
690
+ 383: <span class="ruby-identifier">uri_object</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-keyword kw">self</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">uri</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">to_s</span>)
691
+ 384: <span class="ruby-identifier">segments</span> = {
692
+ 385: <span class="ruby-identifier">:scheme</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">unencode_segment</span>(<span class="ruby-identifier">uri_object</span>.<span class="ruby-identifier">scheme</span>),
693
+ 386: <span class="ruby-identifier">:user</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">unencode_segment</span>(<span class="ruby-identifier">uri_object</span>.<span class="ruby-identifier">user</span>),
694
+ 387: <span class="ruby-identifier">:password</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">unencode_segment</span>(<span class="ruby-identifier">uri_object</span>.<span class="ruby-identifier">password</span>),
695
+ 388: <span class="ruby-identifier">:host</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">unencode_segment</span>(<span class="ruby-identifier">uri_object</span>.<span class="ruby-identifier">host</span>),
696
+ 389: <span class="ruby-identifier">:port</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">unencode_segment</span>(<span class="ruby-identifier">uri_object</span>.<span class="ruby-identifier">specified_port</span>),
697
+ 390: <span class="ruby-identifier">:path</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">unencode_segment</span>(<span class="ruby-identifier">uri_object</span>.<span class="ruby-identifier">path</span>),
698
+ 391: <span class="ruby-identifier">:query</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">unencode_segment</span>(<span class="ruby-identifier">uri_object</span>.<span class="ruby-identifier">query</span>),
699
+ 392: <span class="ruby-identifier">:fragment</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">unencode_segment</span>(<span class="ruby-identifier">uri_object</span>.<span class="ruby-identifier">fragment</span>)
700
+ 393: }
701
+ 394: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">IDNA</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">:use_libidn?</span>)
702
+ 395: <span class="ruby-identifier">segments</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
703
+ 396: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">value</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
704
+ 397: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-constant">IDN</span><span class="ruby-operator">::</span><span class="ruby-constant">Stringprep</span>.<span class="ruby-identifier">nfkc_normalize</span>(<span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_s</span>)
705
+ 398: <span class="ruby-keyword kw">end</span>
706
+ 399: <span class="ruby-keyword kw">end</span>
707
+ 400: <span class="ruby-keyword kw">end</span>
708
+ 401: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span>.<span class="ruby-identifier">new</span>(
709
+ 402: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">encode_segment</span>(<span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:scheme</span>],
710
+ 403: <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">CharacterClasses</span><span class="ruby-operator">::</span><span class="ruby-constant">SCHEME</span>),
711
+ 404: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">encode_segment</span>(<span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:user</span>],
712
+ 405: <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">CharacterClasses</span><span class="ruby-operator">::</span><span class="ruby-constant">AUTHORITY</span>),
713
+ 406: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">encode_segment</span>(<span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:password</span>],
714
+ 407: <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">CharacterClasses</span><span class="ruby-operator">::</span><span class="ruby-constant">AUTHORITY</span>),
715
+ 408: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:host</span>],
716
+ 409: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:port</span>],
717
+ 410: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">encode_segment</span>(<span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:path</span>],
718
+ 411: <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">CharacterClasses</span><span class="ruby-operator">::</span><span class="ruby-constant">PATH</span>),
719
+ 412: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">encode_segment</span>(<span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:query</span>],
720
+ 413: <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">CharacterClasses</span><span class="ruby-operator">::</span><span class="ruby-constant">QUERY</span>),
721
+ 414: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">encode_segment</span>(<span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:fragment</span>],
722
+ 415: <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">CharacterClasses</span><span class="ruby-operator">::</span><span class="ruby-constant">FRAGMENT</span>)
723
+ 416: ).<span class="ruby-identifier">to_s</span>
724
+ 417: <span class="ruby-keyword kw">end</span>
665
725
  </pre>
666
726
  </div>
667
727
  </div>
@@ -721,40 +781,23 @@ Returns a <a href="URI.html">URI</a> object based on the parsed string.
721
781
  93: <span class="ruby-identifier">host</span> = <span class="ruby-identifier">authority</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/^([^\[\]]*)@/</span>, <span class="ruby-value str">&quot;&quot;</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/:([^:@\[\]]*?)$/</span>, <span class="ruby-value str">&quot;&quot;</span>)
722
782
  94: <span class="ruby-identifier">port</span> = <span class="ruby-identifier">authority</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/:([^:@\[\]]*?)$/</span>).<span class="ruby-identifier">flatten</span>[<span class="ruby-value">0</span>]
723
783
  95: <span class="ruby-keyword kw">end</span>
724
- 96: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">port</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">port</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;&quot;</span>
784
+ 96: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">port</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">port</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;&quot;</span>
725
785
  97: <span class="ruby-identifier">port</span> = <span class="ruby-keyword kw">nil</span>
726
786
  98: <span class="ruby-keyword kw">end</span>
727
787
  99:
728
- 100: <span class="ruby-comment cmt"># WARNING: Not standards-compliant, but follows the theme</span>
729
- 101: <span class="ruby-comment cmt"># of Postel's law:</span>
730
- 102: <span class="ruby-comment cmt">#</span>
731
- 103: <span class="ruby-comment cmt"># Special exception for dealing with the retarded idea of the</span>
732
- 104: <span class="ruby-comment cmt"># feed pseudo-protocol. Without this exception, the parser will read</span>
733
- 105: <span class="ruby-comment cmt"># the URI as having a blank port number, instead of as having a second</span>
734
- 106: <span class="ruby-comment cmt"># URI embedded within. This exception translates these broken URIs</span>
735
- 107: <span class="ruby-comment cmt"># and instead treats the inner URI as opaque.</span>
736
- 108: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">scheme</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;feed&quot;</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">host</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;http&quot;</span>
737
- 109: <span class="ruby-identifier">userinfo</span> = <span class="ruby-keyword kw">nil</span>
738
- 110: <span class="ruby-identifier">user</span> = <span class="ruby-keyword kw">nil</span>
739
- 111: <span class="ruby-identifier">password</span> = <span class="ruby-keyword kw">nil</span>
740
- 112: <span class="ruby-identifier">host</span> = <span class="ruby-keyword kw">nil</span>
741
- 113: <span class="ruby-identifier">port</span> = <span class="ruby-keyword kw">nil</span>
742
- 114: <span class="ruby-identifier">path</span> = <span class="ruby-identifier">authority</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">path</span>
743
- 115: <span class="ruby-keyword kw">end</span>
744
- 116:
745
- 117: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span>.<span class="ruby-identifier">new</span>(
746
- 118: <span class="ruby-identifier">scheme</span>, <span class="ruby-identifier">user</span>, <span class="ruby-identifier">password</span>, <span class="ruby-identifier">host</span>, <span class="ruby-identifier">port</span>, <span class="ruby-identifier">path</span>, <span class="ruby-identifier">query</span>, <span class="ruby-identifier">fragment</span>)
747
- 119: <span class="ruby-keyword kw">end</span>
788
+ 100: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span>.<span class="ruby-identifier">new</span>(
789
+ 101: <span class="ruby-identifier">scheme</span>, <span class="ruby-identifier">user</span>, <span class="ruby-identifier">password</span>, <span class="ruby-identifier">host</span>, <span class="ruby-identifier">port</span>, <span class="ruby-identifier">path</span>, <span class="ruby-identifier">query</span>, <span class="ruby-identifier">fragment</span>)
790
+ 102: <span class="ruby-keyword kw">end</span>
748
791
  </pre>
749
792
  </div>
750
793
  </div>
751
794
  </div>
752
795
 
753
- <div id="method-M000025" class="method-detail">
754
- <a name="M000025"></a>
796
+ <div id="method-M000026" class="method-detail">
797
+ <a name="M000026"></a>
755
798
 
756
799
  <div class="method-heading">
757
- <a href="#M000025" class="method-signature">
800
+ <a href="#M000026" class="method-signature">
758
801
  <span class="method-name">scheme_mapping</span><span class="method-args">()</span>
759
802
  </a>
760
803
  </div>
@@ -762,44 +805,44 @@ Returns a <a href="URI.html">URI</a> object based on the parsed string.
762
805
  <div class="method-description">
763
806
  <p>
764
807
  Returns a hash of common IP-based schemes and their default <a
765
- href="URI.html#M000026">port</a> numbers. Adding <a
766
- href="URI.html#M000011">new</a> schemes to this hash, as necessary, will
808
+ href="URI.html#M000027">port</a> numbers. Adding <a
809
+ href="URI.html#M000012">new</a> schemes to this hash, as necessary, will
767
810
  allow for better <a href="URI.html">URI</a> normalization.
768
811
  </p>
769
812
  <p><a class="source-toggle" href="#"
770
- onclick="toggleCode('M000025-source');return false;">[Source]</a></p>
771
- <div class="method-source-code" id="M000025-source">
813
+ onclick="toggleCode('M000026-source');return false;">[Source]</a></p>
814
+ <div class="method-source-code" id="M000026-source">
772
815
  <pre>
773
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 632</span>
774
- 632: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">scheme_mapping</span>
775
- 633: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-keyword kw">defined?</span>(<span class="ruby-ivar">@protocol_mapping</span>) <span class="ruby-operator">||</span> <span class="ruby-ivar">@protocol_mapping</span>.<span class="ruby-identifier">nil?</span>
776
- 634: <span class="ruby-ivar">@protocol_mapping</span> = {
777
- 635: <span class="ruby-value str">&quot;http&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">80</span>,
778
- 636: <span class="ruby-value str">&quot;https&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">443</span>,
779
- 637: <span class="ruby-value str">&quot;ftp&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">21</span>,
780
- 638: <span class="ruby-value str">&quot;tftp&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">69</span>,
781
- 639: <span class="ruby-value str">&quot;ssh&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">22</span>,
782
- 640: <span class="ruby-value str">&quot;svn+ssh&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">22</span>,
783
- 641: <span class="ruby-value str">&quot;telnet&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">23</span>,
784
- 642: <span class="ruby-value str">&quot;nntp&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">119</span>,
785
- 643: <span class="ruby-value str">&quot;gopher&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">70</span>,
786
- 644: <span class="ruby-value str">&quot;wais&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">210</span>,
787
- 645: <span class="ruby-value str">&quot;ldap&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">389</span>,
788
- 646: <span class="ruby-value str">&quot;prospero&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">1525</span>
789
- 647: }
790
- 648: <span class="ruby-keyword kw">end</span>
791
- 649: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@protocol_mapping</span>
792
- 650: <span class="ruby-keyword kw">end</span>
816
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 650</span>
817
+ 650: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">scheme_mapping</span>
818
+ 651: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-keyword kw">defined?</span>(<span class="ruby-ivar">@protocol_mapping</span>) <span class="ruby-operator">||</span> <span class="ruby-ivar">@protocol_mapping</span>.<span class="ruby-identifier">nil?</span>
819
+ 652: <span class="ruby-ivar">@protocol_mapping</span> = {
820
+ 653: <span class="ruby-value str">&quot;http&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">80</span>,
821
+ 654: <span class="ruby-value str">&quot;https&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">443</span>,
822
+ 655: <span class="ruby-value str">&quot;ftp&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">21</span>,
823
+ 656: <span class="ruby-value str">&quot;tftp&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">69</span>,
824
+ 657: <span class="ruby-value str">&quot;ssh&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">22</span>,
825
+ 658: <span class="ruby-value str">&quot;svn+ssh&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">22</span>,
826
+ 659: <span class="ruby-value str">&quot;telnet&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">23</span>,
827
+ 660: <span class="ruby-value str">&quot;nntp&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">119</span>,
828
+ 661: <span class="ruby-value str">&quot;gopher&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">70</span>,
829
+ 662: <span class="ruby-value str">&quot;wais&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">210</span>,
830
+ 663: <span class="ruby-value str">&quot;ldap&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">389</span>,
831
+ 664: <span class="ruby-value str">&quot;prospero&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">1525</span>
832
+ 665: }
833
+ 666: <span class="ruby-keyword kw">end</span>
834
+ 667: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@protocol_mapping</span>
835
+ 668: <span class="ruby-keyword kw">end</span>
793
836
  </pre>
794
837
  </div>
795
838
  </div>
796
839
  </div>
797
840
 
798
- <div id="method-M000007" class="method-detail">
799
- <a name="M000007"></a>
841
+ <div id="method-M000008" class="method-detail">
842
+ <a name="M000008"></a>
800
843
 
801
844
  <div class="method-heading">
802
- <a href="#M000007" class="method-signature">
845
+ <a href="#M000008" class="method-signature">
803
846
  <span class="method-name">unencode_segment</span><span class="method-args">(segment)</span>
804
847
  </a>
805
848
  </div>
@@ -810,16 +853,16 @@ Unencodes any percent encoded characters within a <a
810
853
  href="URI.html">URI</a> segment. Returns a string.
811
854
  </p>
812
855
  <p><a class="source-toggle" href="#"
813
- onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
814
- <div class="method-source-code" id="M000007-source">
856
+ onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
857
+ <div class="method-source-code" id="M000008-source">
815
858
  <pre>
816
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 325</span>
817
- 325: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">unencode_segment</span>(<span class="ruby-identifier">segment</span>)
818
- 326: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">segment</span>.<span class="ruby-identifier">nil?</span>
819
- 327: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">segment</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/%[0-9a-f]{2}/i</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">sequence</span><span class="ruby-operator">|</span>
820
- 328: <span class="ruby-identifier">sequence</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">3</span>].<span class="ruby-identifier">to_i</span>(<span class="ruby-value">16</span>).<span class="ruby-identifier">chr</span>
821
- 329: <span class="ruby-keyword kw">end</span>
822
- 330: <span class="ruby-keyword kw">end</span>
859
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 345</span>
860
+ 345: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">unencode_segment</span>(<span class="ruby-identifier">segment</span>)
861
+ 346: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">segment</span>.<span class="ruby-identifier">nil?</span>
862
+ 347: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">segment</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/%[0-9a-f]{2}/i</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">sequence</span><span class="ruby-operator">|</span>
863
+ 348: <span class="ruby-identifier">sequence</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">3</span>].<span class="ruby-identifier">to_i</span>(<span class="ruby-value">16</span>).<span class="ruby-identifier">chr</span>
864
+ 349: <span class="ruby-keyword kw">end</span>
865
+ 350: <span class="ruby-keyword kw">end</span>
823
866
  </pre>
824
867
  </div>
825
868
  </div>
@@ -827,11 +870,11 @@ href="URI.html">URI</a> segment. Returns a string.
827
870
 
828
871
  <h3 class="section-bar">Public Instance methods</h3>
829
872
 
830
- <div id="method-M000040" class="method-detail">
831
- <a name="M000040"></a>
873
+ <div id="method-M000041" class="method-detail">
874
+ <a name="M000041"></a>
832
875
 
833
876
  <div class="method-heading">
834
- <a href="#M000040" class="method-signature">
877
+ <a href="#M000041" class="method-signature">
835
878
  <span class="method-name">+</span><span class="method-args">(uri)</span>
836
879
  </a>
837
880
  </div>
@@ -841,109 +884,109 @@ href="URI.html">URI</a> segment. Returns a string.
841
884
  Joins two URIs together.
842
885
  </p>
843
886
  <p><a class="source-toggle" href="#"
844
- onclick="toggleCode('M000040-source');return false;">[Source]</a></p>
845
- <div class="method-source-code" id="M000040-source">
887
+ onclick="toggleCode('M000041-source');return false;">[Source]</a></p>
888
+ <div class="method-source-code" id="M000041-source">
846
889
  <pre>
847
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 748</span>
848
- 748: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">+</span>(<span class="ruby-identifier">uri</span>)
849
- 749: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">uri</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>)
850
- 750: <span class="ruby-identifier">uri</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">to_s</span>)
851
- 751: <span class="ruby-keyword kw">end</span>
852
- 752: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;&quot;</span>
853
- 753: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span>
854
- 754: <span class="ruby-keyword kw">end</span>
855
- 755:
856
- 756: <span class="ruby-identifier">joined_scheme</span> = <span class="ruby-keyword kw">nil</span>
857
- 757: <span class="ruby-identifier">joined_user</span> = <span class="ruby-keyword kw">nil</span>
858
- 758: <span class="ruby-identifier">joined_password</span> = <span class="ruby-keyword kw">nil</span>
859
- 759: <span class="ruby-identifier">joined_host</span> = <span class="ruby-keyword kw">nil</span>
860
- 760: <span class="ruby-identifier">joined_port</span> = <span class="ruby-keyword kw">nil</span>
861
- 761: <span class="ruby-identifier">joined_path</span> = <span class="ruby-keyword kw">nil</span>
862
- 762: <span class="ruby-identifier">joined_query</span> = <span class="ruby-keyword kw">nil</span>
863
- 763: <span class="ruby-identifier">joined_fragment</span> = <span class="ruby-keyword kw">nil</span>
864
- 764:
865
- 765: <span class="ruby-comment cmt"># Section 5.2.2 of RFC 3986</span>
866
- 766: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
867
- 767: <span class="ruby-identifier">joined_scheme</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">scheme</span>
868
- 768: <span class="ruby-identifier">joined_user</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">user</span>
869
- 769: <span class="ruby-identifier">joined_password</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">password</span>
870
- 770: <span class="ruby-identifier">joined_host</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">host</span>
871
- 771: <span class="ruby-identifier">joined_port</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">specified_port</span>
872
- 772: <span class="ruby-identifier">joined_path</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">normalize_path</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">path</span>)
873
- 773: <span class="ruby-identifier">joined_query</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">query</span>
874
- 774: <span class="ruby-keyword kw">else</span>
875
- 775: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">authority</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
876
- 776: <span class="ruby-identifier">joined_user</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">user</span>
877
- 777: <span class="ruby-identifier">joined_password</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">password</span>
878
- 778: <span class="ruby-identifier">joined_host</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">host</span>
879
- 779: <span class="ruby-identifier">joined_port</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">specified_port</span>
880
- 780: <span class="ruby-identifier">joined_path</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">normalize_path</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">path</span>)
881
- 781: <span class="ruby-identifier">joined_query</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">query</span>
882
- 782: <span class="ruby-keyword kw">else</span>
883
- 783: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">path</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">path</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;&quot;</span>
884
- 784: <span class="ruby-identifier">joined_path</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">path</span>
885
- 785: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">query</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
886
- 786: <span class="ruby-identifier">joined_query</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">query</span>
887
- 787: <span class="ruby-keyword kw">else</span>
888
- 788: <span class="ruby-identifier">joined_query</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">query</span>
889
- 789: <span class="ruby-keyword kw">end</span>
890
- 790: <span class="ruby-keyword kw">else</span>
891
- 791: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">path</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;/&quot;</span>
892
- 792: <span class="ruby-identifier">joined_path</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">normalize_path</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">path</span>)
893
- 793: <span class="ruby-keyword kw">else</span>
894
- 794: <span class="ruby-identifier">base_path</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">path</span>.<span class="ruby-identifier">dup</span>
895
- 795: <span class="ruby-identifier">base_path</span> = <span class="ruby-value str">&quot;&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">base_path</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
896
- 796: <span class="ruby-identifier">base_path</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">normalize_path</span>(<span class="ruby-identifier">base_path</span>)
897
- 797:
898
- 798: <span class="ruby-comment cmt"># Section 5.2.3 of RFC 3986</span>
899
- 799: <span class="ruby-comment cmt">#</span>
900
- 800: <span class="ruby-comment cmt"># Removes the right-most path segment from the base path.</span>
901
- 801: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">base_path</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/\//</span>
902
- 802: <span class="ruby-identifier">base_path</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/\/[^\/]+$/</span>, <span class="ruby-value str">&quot;/&quot;</span>)
903
- 803: <span class="ruby-keyword kw">else</span>
904
- 804: <span class="ruby-identifier">base_path</span> = <span class="ruby-value str">&quot;&quot;</span>
905
- 805: <span class="ruby-keyword kw">end</span>
906
- 806:
907
- 807: <span class="ruby-comment cmt"># If the base path is empty and an authority segment has been</span>
908
- 808: <span class="ruby-comment cmt"># defined, use a base path of &quot;/&quot;</span>
909
- 809: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">base_path</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;&quot;</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">authority</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
910
- 810: <span class="ruby-identifier">base_path</span> = <span class="ruby-value str">&quot;/&quot;</span>
911
- 811: <span class="ruby-keyword kw">end</span>
912
- 812:
913
- 813: <span class="ruby-identifier">joined_path</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">normalize_path</span>(<span class="ruby-identifier">base_path</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">path</span>)
914
- 814: <span class="ruby-keyword kw">end</span>
915
- 815: <span class="ruby-identifier">joined_query</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">query</span>
916
- 816: <span class="ruby-keyword kw">end</span>
917
- 817: <span class="ruby-identifier">joined_user</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">user</span>
918
- 818: <span class="ruby-identifier">joined_password</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">password</span>
919
- 819: <span class="ruby-identifier">joined_host</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">host</span>
920
- 820: <span class="ruby-identifier">joined_port</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">specified_port</span>
921
- 821: <span class="ruby-keyword kw">end</span>
922
- 822: <span class="ruby-identifier">joined_scheme</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">scheme</span>
923
- 823: <span class="ruby-keyword kw">end</span>
924
- 824: <span class="ruby-identifier">joined_fragment</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">fragment</span>
925
- 825:
926
- 826: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span>.<span class="ruby-identifier">new</span>(
927
- 827: <span class="ruby-identifier">joined_scheme</span>,
928
- 828: <span class="ruby-identifier">joined_user</span>,
929
- 829: <span class="ruby-identifier">joined_password</span>,
930
- 830: <span class="ruby-identifier">joined_host</span>,
931
- 831: <span class="ruby-identifier">joined_port</span>,
932
- 832: <span class="ruby-identifier">joined_path</span>,
933
- 833: <span class="ruby-identifier">joined_query</span>,
934
- 834: <span class="ruby-identifier">joined_fragment</span>
935
- 835: )
936
- 836: <span class="ruby-keyword kw">end</span>
890
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 769</span>
891
+ 769: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">+</span>(<span class="ruby-identifier">uri</span>)
892
+ 770: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">uri</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>)
893
+ 771: <span class="ruby-identifier">uri</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">to_s</span>)
894
+ 772: <span class="ruby-keyword kw">end</span>
895
+ 773: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;&quot;</span>
896
+ 774: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span>
897
+ 775: <span class="ruby-keyword kw">end</span>
898
+ 776:
899
+ 777: <span class="ruby-identifier">joined_scheme</span> = <span class="ruby-keyword kw">nil</span>
900
+ 778: <span class="ruby-identifier">joined_user</span> = <span class="ruby-keyword kw">nil</span>
901
+ 779: <span class="ruby-identifier">joined_password</span> = <span class="ruby-keyword kw">nil</span>
902
+ 780: <span class="ruby-identifier">joined_host</span> = <span class="ruby-keyword kw">nil</span>
903
+ 781: <span class="ruby-identifier">joined_port</span> = <span class="ruby-keyword kw">nil</span>
904
+ 782: <span class="ruby-identifier">joined_path</span> = <span class="ruby-keyword kw">nil</span>
905
+ 783: <span class="ruby-identifier">joined_query</span> = <span class="ruby-keyword kw">nil</span>
906
+ 784: <span class="ruby-identifier">joined_fragment</span> = <span class="ruby-keyword kw">nil</span>
907
+ 785:
908
+ 786: <span class="ruby-comment cmt"># Section 5.2.2 of RFC 3986</span>
909
+ 787: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
910
+ 788: <span class="ruby-identifier">joined_scheme</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">scheme</span>
911
+ 789: <span class="ruby-identifier">joined_user</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">user</span>
912
+ 790: <span class="ruby-identifier">joined_password</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">password</span>
913
+ 791: <span class="ruby-identifier">joined_host</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">host</span>
914
+ 792: <span class="ruby-identifier">joined_port</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">specified_port</span>
915
+ 793: <span class="ruby-identifier">joined_path</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">normalize_path</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">path</span>)
916
+ 794: <span class="ruby-identifier">joined_query</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">query</span>
917
+ 795: <span class="ruby-keyword kw">else</span>
918
+ 796: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">authority</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
919
+ 797: <span class="ruby-identifier">joined_user</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">user</span>
920
+ 798: <span class="ruby-identifier">joined_password</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">password</span>
921
+ 799: <span class="ruby-identifier">joined_host</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">host</span>
922
+ 800: <span class="ruby-identifier">joined_port</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">specified_port</span>
923
+ 801: <span class="ruby-identifier">joined_path</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">normalize_path</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">path</span>)
924
+ 802: <span class="ruby-identifier">joined_query</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">query</span>
925
+ 803: <span class="ruby-keyword kw">else</span>
926
+ 804: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">path</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">path</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;&quot;</span>
927
+ 805: <span class="ruby-identifier">joined_path</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">path</span>
928
+ 806: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">query</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
929
+ 807: <span class="ruby-identifier">joined_query</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">query</span>
930
+ 808: <span class="ruby-keyword kw">else</span>
931
+ 809: <span class="ruby-identifier">joined_query</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">query</span>
932
+ 810: <span class="ruby-keyword kw">end</span>
933
+ 811: <span class="ruby-keyword kw">else</span>
934
+ 812: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">path</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;/&quot;</span>
935
+ 813: <span class="ruby-identifier">joined_path</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">normalize_path</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">path</span>)
936
+ 814: <span class="ruby-keyword kw">else</span>
937
+ 815: <span class="ruby-identifier">base_path</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">path</span>.<span class="ruby-identifier">dup</span>
938
+ 816: <span class="ruby-identifier">base_path</span> = <span class="ruby-value str">&quot;&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">base_path</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
939
+ 817: <span class="ruby-identifier">base_path</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">normalize_path</span>(<span class="ruby-identifier">base_path</span>)
940
+ 818:
941
+ 819: <span class="ruby-comment cmt"># Section 5.2.3 of RFC 3986</span>
942
+ 820: <span class="ruby-comment cmt">#</span>
943
+ 821: <span class="ruby-comment cmt"># Removes the right-most path segment from the base path.</span>
944
+ 822: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">base_path</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/\//</span>
945
+ 823: <span class="ruby-identifier">base_path</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/\/[^\/]+$/</span>, <span class="ruby-value str">&quot;/&quot;</span>)
946
+ 824: <span class="ruby-keyword kw">else</span>
947
+ 825: <span class="ruby-identifier">base_path</span> = <span class="ruby-value str">&quot;&quot;</span>
948
+ 826: <span class="ruby-keyword kw">end</span>
949
+ 827:
950
+ 828: <span class="ruby-comment cmt"># If the base path is empty and an authority segment has been</span>
951
+ 829: <span class="ruby-comment cmt"># defined, use a base path of &quot;/&quot;</span>
952
+ 830: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">base_path</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;&quot;</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">authority</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
953
+ 831: <span class="ruby-identifier">base_path</span> = <span class="ruby-value str">&quot;/&quot;</span>
954
+ 832: <span class="ruby-keyword kw">end</span>
955
+ 833:
956
+ 834: <span class="ruby-identifier">joined_path</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">normalize_path</span>(<span class="ruby-identifier">base_path</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">path</span>)
957
+ 835: <span class="ruby-keyword kw">end</span>
958
+ 836: <span class="ruby-identifier">joined_query</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">query</span>
959
+ 837: <span class="ruby-keyword kw">end</span>
960
+ 838: <span class="ruby-identifier">joined_user</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">user</span>
961
+ 839: <span class="ruby-identifier">joined_password</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">password</span>
962
+ 840: <span class="ruby-identifier">joined_host</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">host</span>
963
+ 841: <span class="ruby-identifier">joined_port</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">specified_port</span>
964
+ 842: <span class="ruby-keyword kw">end</span>
965
+ 843: <span class="ruby-identifier">joined_scheme</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">scheme</span>
966
+ 844: <span class="ruby-keyword kw">end</span>
967
+ 845: <span class="ruby-identifier">joined_fragment</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">fragment</span>
968
+ 846:
969
+ 847: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span>.<span class="ruby-identifier">new</span>(
970
+ 848: <span class="ruby-identifier">joined_scheme</span>,
971
+ 849: <span class="ruby-identifier">joined_user</span>,
972
+ 850: <span class="ruby-identifier">joined_password</span>,
973
+ 851: <span class="ruby-identifier">joined_host</span>,
974
+ 852: <span class="ruby-identifier">joined_port</span>,
975
+ 853: <span class="ruby-identifier">joined_path</span>,
976
+ 854: <span class="ruby-identifier">joined_query</span>,
977
+ 855: <span class="ruby-identifier">joined_fragment</span>
978
+ 856: )
979
+ 857: <span class="ruby-keyword kw">end</span>
937
980
  </pre>
938
981
  </div>
939
982
  </div>
940
983
  </div>
941
984
 
942
- <div id="method-M000051" class="method-detail">
943
- <a name="M000051"></a>
985
+ <div id="method-M000052" class="method-detail">
986
+ <a name="M000052"></a>
944
987
 
945
988
  <div class="method-heading">
946
- <a href="#M000051" class="method-signature">
989
+ <a href="#M000052" class="method-signature">
947
990
  <span class="method-name">==</span><span class="method-args">(uri)</span>
948
991
  </a>
949
992
  </div>
@@ -954,24 +997,24 @@ Returns true if the <a href="URI.html">URI</a> objects are equal. This
954
997
  method normalizes both URIs before doing the comparison.
955
998
  </p>
956
999
  <p><a class="source-toggle" href="#"
957
- onclick="toggleCode('M000051-source');return false;">[Source]</a></p>
958
- <div class="method-source-code" id="M000051-source">
1000
+ onclick="toggleCode('M000052-source');return false;">[Source]</a></p>
1001
+ <div class="method-source-code" id="M000052-source">
959
1002
  <pre>
960
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 1023</span>
961
- 1023: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">==</span>(<span class="ruby-identifier">uri</span>)
962
- 1024: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>)
963
- 1025: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">normalize</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">normalize</span>.<span class="ruby-identifier">to_s</span>
964
- 1026: <span class="ruby-keyword kw">end</span>
1003
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 1043</span>
1004
+ 1043: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">==</span>(<span class="ruby-identifier">uri</span>)
1005
+ 1044: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>)
1006
+ 1045: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">normalize</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">normalize</span>.<span class="ruby-identifier">to_s</span>
1007
+ 1046: <span class="ruby-keyword kw">end</span>
965
1008
  </pre>
966
1009
  </div>
967
1010
  </div>
968
1011
  </div>
969
1012
 
970
- <div id="method-M000050" class="method-detail">
971
- <a name="M000050"></a>
1013
+ <div id="method-M000051" class="method-detail">
1014
+ <a name="M000051"></a>
972
1015
 
973
1016
  <div class="method-heading">
974
- <a href="#M000050" class="method-signature">
1017
+ <a href="#M000051" class="method-signature">
975
1018
  <span class="method-name">===</span><span class="method-args">(uri)</span>
976
1019
  </a>
977
1020
  </div>
@@ -983,33 +1026,32 @@ method normalizes both URIs before doing the comparison, and allows
983
1026
  comparison against strings.
984
1027
  </p>
985
1028
  <p><a class="source-toggle" href="#"
986
- onclick="toggleCode('M000050-source');return false;">[Source]</a></p>
987
- <div class="method-source-code" id="M000050-source">
1029
+ onclick="toggleCode('M000051-source');return false;">[Source]</a></p>
1030
+ <div class="method-source-code" id="M000051-source">
988
1031
  <pre>
989
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 1007</span>
990
- 1007: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">===</span>(<span class="ruby-identifier">uri</span>)
991
- 1008: <span class="ruby-identifier">uri_string</span> = <span class="ruby-keyword kw">nil</span>
992
- 1009: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:normalize</span>)
993
- 1010: <span class="ruby-identifier">uri_string</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">normalize</span>.<span class="ruby-identifier">to_s</span>
994
- 1011: <span class="ruby-keyword kw">else</span>
995
- 1012: <span class="ruby-keyword kw">begin</span>
996
- 1013: <span class="ruby-identifier">uri_string</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">to_s</span>).<span class="ruby-identifier">normalize</span>.<span class="ruby-identifier">to_s</span>
997
- 1014: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span>
998
- 1015: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
999
- 1016: <span class="ruby-keyword kw">end</span>
1000
- 1017: <span class="ruby-keyword kw">end</span>
1001
- 1018: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">normalize</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">uri_string</span>
1002
- 1019: <span class="ruby-keyword kw">end</span>
1032
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 1028</span>
1033
+ 1028: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">===</span>(<span class="ruby-identifier">uri</span>)
1034
+ 1029: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:normalize</span>)
1035
+ 1030: <span class="ruby-identifier">uri_string</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">normalize</span>.<span class="ruby-identifier">to_s</span>
1036
+ 1031: <span class="ruby-keyword kw">else</span>
1037
+ 1032: <span class="ruby-keyword kw">begin</span>
1038
+ 1033: <span class="ruby-identifier">uri_string</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">to_s</span>).<span class="ruby-identifier">normalize</span>.<span class="ruby-identifier">to_s</span>
1039
+ 1034: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">InvalidURIError</span>
1040
+ 1035: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
1041
+ 1036: <span class="ruby-keyword kw">end</span>
1042
+ 1037: <span class="ruby-keyword kw">end</span>
1043
+ 1038: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">normalize</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">uri_string</span>
1044
+ 1039: <span class="ruby-keyword kw">end</span>
1003
1045
  </pre>
1004
1046
  </div>
1005
1047
  </div>
1006
1048
  </div>
1007
1049
 
1008
- <div id="method-M000039" class="method-detail">
1009
- <a name="M000039"></a>
1050
+ <div id="method-M000040" class="method-detail">
1051
+ <a name="M000040"></a>
1010
1052
 
1011
1053
  <div class="method-heading">
1012
- <a href="#M000039" class="method-signature">
1054
+ <a href="#M000040" class="method-signature">
1013
1055
  <span class="method-name">absolute?</span><span class="method-args">()</span>
1014
1056
  </a>
1015
1057
  </div>
@@ -1019,140 +1061,139 @@ comparison against strings.
1019
1061
  Returns true if this <a href="URI.html">URI</a> is known to be absolute.
1020
1062
  </p>
1021
1063
  <p><a class="source-toggle" href="#"
1022
- onclick="toggleCode('M000039-source');return false;">[Source]</a></p>
1023
- <div class="method-source-code" id="M000039-source">
1064
+ onclick="toggleCode('M000040-source');return false;">[Source]</a></p>
1065
+ <div class="method-source-code" id="M000040-source">
1024
1066
  <pre>
1025
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 743</span>
1026
- 743: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">absolute?</span>
1027
- 744: <span class="ruby-keyword kw">return</span> <span class="ruby-operator">!</span><span class="ruby-identifier">relative?</span>
1028
- 745: <span class="ruby-keyword kw">end</span>
1067
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 764</span>
1068
+ 764: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">absolute?</span>
1069
+ 765: <span class="ruby-keyword kw">return</span> <span class="ruby-operator">!</span><span class="ruby-identifier">relative?</span>
1070
+ 766: <span class="ruby-keyword kw">end</span>
1029
1071
  </pre>
1030
1072
  </div>
1031
1073
  </div>
1032
1074
  </div>
1033
1075
 
1034
- <div id="method-M000022" class="method-detail">
1035
- <a name="M000022"></a>
1076
+ <div id="method-M000023" class="method-detail">
1077
+ <a name="M000023"></a>
1036
1078
 
1037
1079
  <div class="method-heading">
1038
- <a href="#M000022" class="method-signature">
1080
+ <a href="#M000023" class="method-signature">
1039
1081
  <span class="method-name">authority</span><span class="method-args">()</span>
1040
1082
  </a>
1041
1083
  </div>
1042
1084
 
1043
1085
  <div class="method-description">
1044
1086
  <p>
1045
- Returns the <a href="URI.html#M000022">authority</a> segment of this <a
1087
+ Returns the <a href="URI.html#M000023">authority</a> segment of this <a
1046
1088
  href="URI.html">URI</a>.
1047
1089
  </p>
1048
1090
  <p><a class="source-toggle" href="#"
1049
- onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
1050
- <div class="method-source-code" id="M000022-source">
1091
+ onclick="toggleCode('M000023-source');return false;">[Source]</a></p>
1092
+ <div class="method-source-code" id="M000023-source">
1051
1093
  <pre>
1052
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 579</span>
1053
- 579: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">authority</span>
1054
- 580: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-keyword kw">defined?</span>(<span class="ruby-ivar">@authority</span>) <span class="ruby-operator">||</span> <span class="ruby-ivar">@authority</span>.<span class="ruby-identifier">nil?</span>
1055
- 581: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">host</span>.<span class="ruby-identifier">nil?</span>
1056
- 582: <span class="ruby-ivar">@authority</span> = <span class="ruby-value str">&quot;&quot;</span>
1057
- 583: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">userinfo</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
1058
- 584: <span class="ruby-ivar">@authority</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;#{self.userinfo}@&quot;</span>
1059
- 585: <span class="ruby-keyword kw">end</span>
1060
- 586: <span class="ruby-ivar">@authority</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">host</span>
1061
- 587: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">specified_port</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
1062
- 588: <span class="ruby-ivar">@authority</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;:#{self.specified_port}&quot;</span>
1063
- 589: <span class="ruby-keyword kw">end</span>
1064
- 590: <span class="ruby-keyword kw">end</span>
1065
- 591: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@authority</span>
1066
- 592: <span class="ruby-keyword kw">end</span>
1094
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 598</span>
1095
+ 598: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">authority</span>
1096
+ 599: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-keyword kw">defined?</span>(<span class="ruby-ivar">@authority</span>) <span class="ruby-operator">||</span> <span class="ruby-ivar">@authority</span>.<span class="ruby-identifier">nil?</span>
1097
+ 600: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">host</span>.<span class="ruby-identifier">nil?</span>
1098
+ 601: <span class="ruby-ivar">@authority</span> = <span class="ruby-value str">&quot;&quot;</span>
1099
+ 602: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">userinfo</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
1100
+ 603: <span class="ruby-ivar">@authority</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;#{self.userinfo}@&quot;</span>
1101
+ 604: <span class="ruby-keyword kw">end</span>
1102
+ 605: <span class="ruby-ivar">@authority</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">host</span>
1103
+ 606: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">specified_port</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
1104
+ 607: <span class="ruby-ivar">@authority</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;:#{self.specified_port}&quot;</span>
1105
+ 608: <span class="ruby-keyword kw">end</span>
1106
+ 609: <span class="ruby-keyword kw">end</span>
1107
+ 610: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@authority</span>
1108
+ 611: <span class="ruby-keyword kw">end</span>
1067
1109
  </pre>
1068
1110
  </div>
1069
1111
  </div>
1070
1112
  </div>
1071
1113
 
1072
- <div id="method-M000023" class="method-detail">
1073
- <a name="M000023"></a>
1114
+ <div id="method-M000024" class="method-detail">
1115
+ <a name="M000024"></a>
1074
1116
 
1075
1117
  <div class="method-heading">
1076
- <a href="#M000023" class="method-signature">
1118
+ <a href="#M000024" class="method-signature">
1077
1119
  <span class="method-name">authority=</span><span class="method-args">(new_authority)</span>
1078
1120
  </a>
1079
1121
  </div>
1080
1122
 
1081
1123
  <div class="method-description">
1082
1124
  <p>
1083
- Sets the <a href="URI.html#M000022">authority</a> segment of this <a
1125
+ Sets the <a href="URI.html#M000023">authority</a> segment of this <a
1084
1126
  href="URI.html">URI</a>.
1085
1127
  </p>
1086
1128
  <p><a class="source-toggle" href="#"
1087
- onclick="toggleCode('M000023-source');return false;">[Source]</a></p>
1088
- <div class="method-source-code" id="M000023-source">
1129
+ onclick="toggleCode('M000024-source');return false;">[Source]</a></p>
1130
+ <div class="method-source-code" id="M000024-source">
1089
1131
  <pre>
1090
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 595</span>
1091
- 595: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">authority=</span>(<span class="ruby-identifier">new_authority</span>)
1092
- 596: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">new_authority</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
1093
- 597: <span class="ruby-identifier">new_userinfo</span> = <span class="ruby-identifier">new_authority</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/^([^\[\]]*)@/</span>).<span class="ruby-identifier">flatten</span>[<span class="ruby-value">0</span>]
1094
- 598: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">new_userinfo</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
1095
- 599: <span class="ruby-identifier">new_user</span> = <span class="ruby-identifier">new_userinfo</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/^([^:]*):?/</span>).<span class="ruby-identifier">flatten</span>[<span class="ruby-value">0</span>]
1096
- 600: <span class="ruby-identifier">new_password</span> = <span class="ruby-identifier">new_userinfo</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/:(.*)$/</span>).<span class="ruby-identifier">flatten</span>[<span class="ruby-value">0</span>]
1097
- 601: <span class="ruby-keyword kw">end</span>
1098
- 602: <span class="ruby-identifier">new_host</span> =
1099
- 603: <span class="ruby-identifier">new_authority</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/^([^\[\]]*)@/</span>, <span class="ruby-value str">&quot;&quot;</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/:([^:@\[\]]*?)$/</span>, <span class="ruby-value str">&quot;&quot;</span>)
1100
- 604: <span class="ruby-identifier">new_port</span> =
1101
- 605: <span class="ruby-identifier">new_authority</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/:([^:@\[\]]*?)$/</span>).<span class="ruby-identifier">flatten</span>[<span class="ruby-value">0</span>]
1102
- 606: <span class="ruby-keyword kw">end</span>
1103
- 607: <span class="ruby-identifier">new_port</span> = <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">new_port</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;&quot;</span>
1104
- 608:
1105
- 609: <span class="ruby-comment cmt"># Password assigned first to ensure validity in case of nil</span>
1106
- 610: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">password</span> = <span class="ruby-identifier">new_password</span>
1107
- 611: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">user</span> = <span class="ruby-identifier">new_user</span>
1108
- 612: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">host</span> = <span class="ruby-identifier">new_host</span>
1109
- 613:
1110
- 614: <span class="ruby-comment cmt"># Port reset to allow port normalization</span>
1111
- 615: <span class="ruby-ivar">@port</span> = <span class="ruby-keyword kw">nil</span>
1112
- 616: <span class="ruby-ivar">@specified_port</span> = <span class="ruby-identifier">new_port</span>
1113
- 617:
1114
- 618: <span class="ruby-comment cmt"># Ensure we haven't created an invalid URI</span>
1115
- 619: <span class="ruby-identifier">validate</span>()
1116
- 620: <span class="ruby-keyword kw">end</span>
1132
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 614</span>
1133
+ 614: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">authority=</span>(<span class="ruby-identifier">new_authority</span>)
1134
+ 615: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">new_authority</span>
1135
+ 616: <span class="ruby-identifier">new_userinfo</span> = <span class="ruby-identifier">new_authority</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/^([^\[\]]*)@/</span>).<span class="ruby-identifier">flatten</span>[<span class="ruby-value">0</span>]
1136
+ 617: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">new_userinfo</span>
1137
+ 618: <span class="ruby-identifier">new_user</span> = <span class="ruby-identifier">new_userinfo</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/^([^:]*):?/</span>).<span class="ruby-identifier">flatten</span>[<span class="ruby-value">0</span>]
1138
+ 619: <span class="ruby-identifier">new_password</span> = <span class="ruby-identifier">new_userinfo</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/:(.*)$/</span>).<span class="ruby-identifier">flatten</span>[<span class="ruby-value">0</span>]
1139
+ 620: <span class="ruby-keyword kw">end</span>
1140
+ 621: <span class="ruby-identifier">new_host</span> =
1141
+ 622: <span class="ruby-identifier">new_authority</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/^([^\[\]]*)@/</span>, <span class="ruby-value str">&quot;&quot;</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/:([^:@\[\]]*?)$/</span>, <span class="ruby-value str">&quot;&quot;</span>)
1142
+ 623: <span class="ruby-identifier">new_port</span> =
1143
+ 624: <span class="ruby-identifier">new_authority</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/:([^:@\[\]]*?)$/</span>).<span class="ruby-identifier">flatten</span>[<span class="ruby-value">0</span>]
1144
+ 625: <span class="ruby-keyword kw">end</span>
1145
+ 626:
1146
+ 627: <span class="ruby-comment cmt"># Password assigned first to ensure validity in case of nil</span>
1147
+ 628: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">password</span> = <span class="ruby-identifier">new_password</span>
1148
+ 629: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">user</span> = <span class="ruby-identifier">new_user</span>
1149
+ 630: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">host</span> = <span class="ruby-identifier">new_host</span>
1150
+ 631:
1151
+ 632: <span class="ruby-comment cmt"># Port reset to allow port normalization</span>
1152
+ 633: <span class="ruby-ivar">@port</span> = <span class="ruby-keyword kw">nil</span>
1153
+ 634: <span class="ruby-ivar">@specified_port</span> = <span class="ruby-identifier">new_port</span>
1154
+ 635:
1155
+ 636: <span class="ruby-comment cmt"># Ensure we haven't created an invalid URI</span>
1156
+ 637: <span class="ruby-identifier">validate</span>()
1157
+ 638: <span class="ruby-keyword kw">end</span>
1117
1158
  </pre>
1118
1159
  </div>
1119
1160
  </div>
1120
1161
  </div>
1121
1162
 
1122
- <div id="method-M000031" class="method-detail">
1123
- <a name="M000031"></a>
1163
+ <div id="method-M000032" class="method-detail">
1164
+ <a name="M000032"></a>
1124
1165
 
1125
1166
  <div class="method-heading">
1126
- <a href="#M000031" class="method-signature">
1167
+ <a href="#M000032" class="method-signature">
1127
1168
  <span class="method-name">basename</span><span class="method-args">()</span>
1128
1169
  </a>
1129
1170
  </div>
1130
1171
 
1131
1172
  <div class="method-description">
1132
1173
  <p>
1133
- Returns the <a href="URI.html#M000031">basename</a>, if any, of the file at
1134
- the <a href="URI.html#M000029">path</a> being referenced. Returns nil if
1135
- there is no <a href="URI.html#M000029">path</a> component.
1174
+ Returns the <a href="URI.html#M000032">basename</a>, if any, of the file at
1175
+ the <a href="URI.html#M000030">path</a> being referenced. Returns nil if
1176
+ there is no <a href="URI.html#M000030">path</a> component.
1136
1177
  </p>
1137
1178
  <p><a class="source-toggle" href="#"
1138
- onclick="toggleCode('M000031-source');return false;">[Source]</a></p>
1139
- <div class="method-source-code" id="M000031-source">
1179
+ onclick="toggleCode('M000032-source');return false;">[Source]</a></p>
1180
+ <div class="method-source-code" id="M000032-source">
1140
1181
  <pre>
1141
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 698</span>
1142
- 698: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">basename</span>
1143
- 699: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">path</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
1144
- 700: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">path</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/;[^\/]*$/</span>, <span class="ruby-value str">&quot;&quot;</span>)
1145
- 701: <span class="ruby-keyword kw">end</span>
1182
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 716</span>
1183
+ 716: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">basename</span>
1184
+ 717: <span class="ruby-comment cmt"># Path cannot be nil</span>
1185
+ 718: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">path</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/;[^\/]*$/</span>, <span class="ruby-value str">&quot;&quot;</span>)
1186
+ 719: <span class="ruby-keyword kw">end</span>
1146
1187
  </pre>
1147
1188
  </div>
1148
1189
  </div>
1149
1190
  </div>
1150
1191
 
1151
- <div id="method-M000049" class="method-detail">
1152
- <a name="M000049"></a>
1192
+ <div id="method-M000050" class="method-detail">
1193
+ <a name="M000050"></a>
1153
1194
 
1154
1195
  <div class="method-heading">
1155
- <a href="#M000049" class="method-signature">
1196
+ <a href="#M000050" class="method-signature">
1156
1197
  <span class="method-name">display_uri</span><span class="method-args">()</span>
1157
1198
  </a>
1158
1199
  </div>
@@ -1161,34 +1202,34 @@ there is no <a href="URI.html#M000029">path</a> component.
1161
1202
  <p>
1162
1203
  Creates a <a href="URI.html">URI</a> suitable for display to users. If
1163
1204
  semantic attacks are likely, the application should try to detect these and
1164
- warn the <a href="URI.html#M000014">user</a>. See RFC 3986 section 7.6 for
1205
+ warn the <a href="URI.html#M000015">user</a>. See RFC 3986 section 7.6 for
1165
1206
  more information.
1166
1207
  </p>
1167
1208
  <p><a class="source-toggle" href="#"
1168
- onclick="toggleCode('M000049-source');return false;">[Source]</a></p>
1169
- <div class="method-source-code" id="M000049-source">
1209
+ onclick="toggleCode('M000050-source');return false;">[Source]</a></p>
1210
+ <div class="method-source-code" id="M000050-source">
1170
1211
  <pre>
1171
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 993</span>
1172
- 993: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">display_uri</span>
1173
- 994: <span class="ruby-identifier">display_uri</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">normalize</span>
1174
- 995: <span class="ruby-keyword kw">begin</span>
1175
- 996: <span class="ruby-identifier">display_uri</span>.<span class="ruby-identifier">instance_variable_set</span>(<span class="ruby-value str">&quot;@host&quot;</span>,
1176
- 997: <span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">IDNA</span>.<span class="ruby-identifier">to_unicode</span>(<span class="ruby-identifier">display_uri</span>.<span class="ruby-identifier">host</span>))
1177
- 998: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span>
1178
- 999: <span class="ruby-keyword kw">nil</span>
1179
- 1000: <span class="ruby-keyword kw">end</span>
1180
- 1001: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">display_uri</span>
1181
- 1002: <span class="ruby-keyword kw">end</span>
1212
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 1014</span>
1213
+ 1014: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">display_uri</span>
1214
+ 1015: <span class="ruby-identifier">display_uri</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">normalize</span>
1215
+ 1016: <span class="ruby-keyword kw">begin</span>
1216
+ 1017: <span class="ruby-identifier">display_uri</span>.<span class="ruby-identifier">instance_variable_set</span>(<span class="ruby-value str">&quot;@host&quot;</span>,
1217
+ 1018: <span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">IDNA</span>.<span class="ruby-identifier">to_unicode</span>(<span class="ruby-identifier">display_uri</span>.<span class="ruby-identifier">host</span>))
1218
+ 1019: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span>
1219
+ 1020: <span class="ruby-keyword kw">nil</span>
1220
+ 1021: <span class="ruby-keyword kw">end</span>
1221
+ 1022: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">display_uri</span>
1222
+ 1023: <span class="ruby-keyword kw">end</span>
1182
1223
  </pre>
1183
1224
  </div>
1184
1225
  </div>
1185
1226
  </div>
1186
1227
 
1187
- <div id="method-M000053" class="method-detail">
1188
- <a name="M000053"></a>
1228
+ <div id="method-M000054" class="method-detail">
1229
+ <a name="M000054"></a>
1189
1230
 
1190
1231
  <div class="method-heading">
1191
- <a href="#M000053" class="method-signature">
1232
+ <a href="#M000054" class="method-signature">
1192
1233
  <span class="method-name">dup</span><span class="method-args">()</span>
1193
1234
  </a>
1194
1235
  </div>
@@ -1198,50 +1239,41 @@ more information.
1198
1239
  Clones the <a href="URI.html">URI</a> object.
1199
1240
  </p>
1200
1241
  <p><a class="source-toggle" href="#"
1201
- onclick="toggleCode('M000053-source');return false;">[Source]</a></p>
1202
- <div class="method-source-code" id="M000053-source">
1242
+ onclick="toggleCode('M000054-source');return false;">[Source]</a></p>
1243
+ <div class="method-source-code" id="M000054-source">
1203
1244
  <pre>
1204
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 1036</span>
1205
- 1036: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dup</span>
1206
- 1037: <span class="ruby-identifier">duplicated_scheme</span> = <span class="ruby-keyword kw">nil</span>
1207
- 1038: <span class="ruby-identifier">duplicated_scheme</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">scheme</span>.<span class="ruby-identifier">dup</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
1208
- 1039: <span class="ruby-identifier">duplicated_user</span> = <span class="ruby-keyword kw">nil</span>
1209
- 1040: <span class="ruby-identifier">duplicated_user</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">user</span>.<span class="ruby-identifier">dup</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">user</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
1210
- 1041: <span class="ruby-identifier">duplicated_password</span> = <span class="ruby-keyword kw">nil</span>
1211
- 1042: <span class="ruby-identifier">duplicated_password</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">password</span>.<span class="ruby-identifier">dup</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">password</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
1212
- 1043: <span class="ruby-identifier">duplicated_host</span> = <span class="ruby-keyword kw">nil</span>
1213
- 1044: <span class="ruby-identifier">duplicated_host</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">host</span>.<span class="ruby-identifier">dup</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">host</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
1214
- 1045: <span class="ruby-identifier">duplicated_port</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">port</span>
1215
- 1046: <span class="ruby-identifier">duplicated_path</span> = <span class="ruby-keyword kw">nil</span>
1216
- 1047: <span class="ruby-identifier">duplicated_path</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">path</span>.<span class="ruby-identifier">dup</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">path</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
1217
- 1048: <span class="ruby-identifier">duplicated_query</span> = <span class="ruby-keyword kw">nil</span>
1218
- 1049: <span class="ruby-identifier">duplicated_query</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">query</span>.<span class="ruby-identifier">dup</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">query</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
1219
- 1050: <span class="ruby-identifier">duplicated_fragment</span> = <span class="ruby-keyword kw">nil</span>
1220
- 1051: <span class="ruby-identifier">duplicated_fragment</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fragment</span>.<span class="ruby-identifier">dup</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fragment</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
1221
- 1052: <span class="ruby-identifier">duplicated_uri</span> = <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span>.<span class="ruby-identifier">new</span>(
1222
- 1053: <span class="ruby-identifier">duplicated_scheme</span>,
1223
- 1054: <span class="ruby-identifier">duplicated_user</span>,
1224
- 1055: <span class="ruby-identifier">duplicated_password</span>,
1225
- 1056: <span class="ruby-identifier">duplicated_host</span>,
1226
- 1057: <span class="ruby-identifier">duplicated_port</span>,
1227
- 1058: <span class="ruby-identifier">duplicated_path</span>,
1228
- 1059: <span class="ruby-identifier">duplicated_query</span>,
1229
- 1060: <span class="ruby-identifier">duplicated_fragment</span>
1230
- 1061: )
1231
- 1062: <span class="ruby-ivar">@specified_port</span> = <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-keyword kw">defined?</span>(<span class="ruby-ivar">@specified_port</span>)
1232
- 1063: <span class="ruby-identifier">duplicated_uri</span>.<span class="ruby-identifier">instance_variable_set</span>(<span class="ruby-value str">&quot;@specified_port&quot;</span>, <span class="ruby-ivar">@specified_port</span>)
1233
- 1064: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">duplicated_uri</span>
1234
- 1065: <span class="ruby-keyword kw">end</span>
1245
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 1056</span>
1246
+ 1056: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dup</span>
1247
+ 1057: <span class="ruby-identifier">duplicated_scheme</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-value">? </span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">scheme</span>.<span class="ruby-identifier">dup</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">nil</span>
1248
+ 1058: <span class="ruby-identifier">duplicated_user</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">user</span> <span class="ruby-value">? </span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">user</span>.<span class="ruby-identifier">dup</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">nil</span>
1249
+ 1059: <span class="ruby-identifier">duplicated_password</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">password</span> <span class="ruby-value">? </span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">password</span>.<span class="ruby-identifier">dup</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">nil</span>
1250
+ 1060: <span class="ruby-identifier">duplicated_host</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">host</span> <span class="ruby-value">? </span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">host</span>.<span class="ruby-identifier">dup</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">nil</span>
1251
+ 1061: <span class="ruby-identifier">duplicated_port</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">specified_port</span>
1252
+ 1062: <span class="ruby-identifier">duplicated_path</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">path</span> <span class="ruby-value">? </span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">path</span>.<span class="ruby-identifier">dup</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">nil</span>
1253
+ 1063: <span class="ruby-identifier">duplicated_query</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">query</span> <span class="ruby-value">? </span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">query</span>.<span class="ruby-identifier">dup</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">nil</span>
1254
+ 1064: <span class="ruby-identifier">duplicated_fragment</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fragment</span> <span class="ruby-value">? </span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fragment</span>.<span class="ruby-identifier">dup</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">nil</span>
1255
+ 1065: <span class="ruby-identifier">duplicated_uri</span> = <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span>.<span class="ruby-identifier">new</span>(
1256
+ 1066: <span class="ruby-identifier">duplicated_scheme</span>,
1257
+ 1067: <span class="ruby-identifier">duplicated_user</span>,
1258
+ 1068: <span class="ruby-identifier">duplicated_password</span>,
1259
+ 1069: <span class="ruby-identifier">duplicated_host</span>,
1260
+ 1070: <span class="ruby-identifier">duplicated_port</span>,
1261
+ 1071: <span class="ruby-identifier">duplicated_path</span>,
1262
+ 1072: <span class="ruby-identifier">duplicated_query</span>,
1263
+ 1073: <span class="ruby-identifier">duplicated_fragment</span>
1264
+ 1074: )
1265
+ 1075: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">duplicated_uri</span>
1266
+ 1076: <span class="ruby-keyword kw">end</span>
1235
1267
  </pre>
1236
1268
  </div>
1237
1269
  </div>
1238
1270
  </div>
1239
1271
 
1240
- <div id="method-M000052" class="method-detail">
1241
- <a name="M000052"></a>
1272
+ <div id="method-M000053" class="method-detail">
1273
+ <a name="M000053"></a>
1242
1274
 
1243
1275
  <div class="method-heading">
1244
- <a href="#M000052" class="method-signature">
1276
+ <a href="#M000053" class="method-signature">
1245
1277
  <span class="method-name">eql?</span><span class="method-args">(uri)</span>
1246
1278
  </a>
1247
1279
  </div>
@@ -1249,28 +1281,28 @@ Clones the <a href="URI.html">URI</a> object.
1249
1281
  <div class="method-description">
1250
1282
  <p>
1251
1283
  Returns true if the <a href="URI.html">URI</a> objects are equal. This
1252
- method does NOT <a href="URI.html#M000047">normalize</a> either <a
1284
+ method does NOT <a href="URI.html#M000048">normalize</a> either <a
1253
1285
  href="URI.html">URI</a> before doing the comparison.
1254
1286
  </p>
1255
1287
  <p><a class="source-toggle" href="#"
1256
- onclick="toggleCode('M000052-source');return false;">[Source]</a></p>
1257
- <div class="method-source-code" id="M000052-source">
1288
+ onclick="toggleCode('M000053-source');return false;">[Source]</a></p>
1289
+ <div class="method-source-code" id="M000053-source">
1258
1290
  <pre>
1259
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 1030</span>
1260
- 1030: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">eql?</span>(<span class="ruby-identifier">uri</span>)
1261
- 1031: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>)
1262
- 1032: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">to_s</span>
1263
- 1033: <span class="ruby-keyword kw">end</span>
1291
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 1050</span>
1292
+ 1050: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">eql?</span>(<span class="ruby-identifier">uri</span>)
1293
+ 1051: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>)
1294
+ 1052: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">to_s</span>
1295
+ 1053: <span class="ruby-keyword kw">end</span>
1264
1296
  </pre>
1265
1297
  </div>
1266
1298
  </div>
1267
1299
  </div>
1268
1300
 
1269
- <div id="method-M000032" class="method-detail">
1270
- <a name="M000032"></a>
1301
+ <div id="method-M000033" class="method-detail">
1302
+ <a name="M000033"></a>
1271
1303
 
1272
1304
  <div class="method-heading">
1273
- <a href="#M000032" class="method-signature">
1305
+ <a href="#M000033" class="method-signature">
1274
1306
  <span class="method-name">extname</span><span class="method-args">()</span>
1275
1307
  </a>
1276
1308
  </div>
@@ -1278,29 +1310,29 @@ href="URI.html">URI</a> before doing the comparison.
1278
1310
  <div class="method-description">
1279
1311
  <p>
1280
1312
  Returns the extension, if any, of the file at the <a
1281
- href="URI.html#M000029">path</a> being referenced. Returns &quot;&quot; if
1313
+ href="URI.html#M000030">path</a> being referenced. Returns &quot;&quot; if
1282
1314
  there is no extension or nil if there is no <a
1283
- href="URI.html#M000029">path</a> component.
1315
+ href="URI.html#M000030">path</a> component.
1284
1316
  </p>
1285
1317
  <p><a class="source-toggle" href="#"
1286
- onclick="toggleCode('M000032-source');return false;">[Source]</a></p>
1287
- <div class="method-source-code" id="M000032-source">
1318
+ onclick="toggleCode('M000033-source');return false;">[Source]</a></p>
1319
+ <div class="method-source-code" id="M000033-source">
1288
1320
  <pre>
1289
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 706</span>
1290
- 706: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">extname</span>
1291
- 707: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">path</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
1292
- 708: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">extname</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">basename</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/;[^\/]*$/</span>, <span class="ruby-value str">&quot;&quot;</span>))
1293
- 709: <span class="ruby-keyword kw">end</span>
1321
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 724</span>
1322
+ 724: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">extname</span>
1323
+ 725: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">path</span>
1324
+ 726: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">extname</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">basename</span>)
1325
+ 727: <span class="ruby-keyword kw">end</span>
1294
1326
  </pre>
1295
1327
  </div>
1296
1328
  </div>
1297
1329
  </div>
1298
1330
 
1299
- <div id="method-M000004" class="method-detail">
1300
- <a name="M000004"></a>
1331
+ <div id="method-M000005" class="method-detail">
1332
+ <a name="M000005"></a>
1301
1333
 
1302
1334
  <div class="method-heading">
1303
- <a href="#M000004" class="method-signature">
1335
+ <a href="#M000005" class="method-signature">
1304
1336
  <span class="method-name">extract_mapping</span><span class="method-args">(pattern, processor=nil)</span>
1305
1337
  </a>
1306
1338
  </div>
@@ -1350,174 +1382,174 @@ An example:
1350
1382
  =&gt; {&quot;first&quot; =&gt; &quot;a&quot;, &quot;second&quot; =&gt; &quot;b/c&quot;}
1351
1383
  </pre>
1352
1384
  <p><a class="source-toggle" href="#"
1353
- onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
1354
- <div class="method-source-code" id="M000004-source">
1385
+ onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
1386
+ <div class="method-source-code" id="M000005-source">
1355
1387
  <pre>
1356
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 247</span>
1357
- 247: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">extract_mapping</span>(<span class="ruby-identifier">pattern</span>, <span class="ruby-identifier">processor</span>=<span class="ruby-keyword kw">nil</span>)
1358
- 248: <span class="ruby-identifier">mapping</span> = {}
1359
- 249: <span class="ruby-identifier">variable_regexp</span> =
1360
- 250: <span class="ruby-node">/\{([#{Addressable::URI::CharacterClasses::UNRESERVED}]+)\}/</span>
1361
- 251: <span class="ruby-identifier">variables</span> = <span class="ruby-identifier">pattern</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-identifier">variable_regexp</span>).<span class="ruby-identifier">flatten</span>
1362
- 252: <span class="ruby-identifier">variables</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">mapping</span>[<span class="ruby-identifier">v</span>] = <span class="ruby-value str">&quot;&quot;</span> }
1363
- 253: <span class="ruby-identifier">escaped_pattern</span> =
1364
- 254: <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">escape</span>(<span class="ruby-identifier">pattern</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\\\{/</span>, <span class="ruby-value str">&quot;{&quot;</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\\\}/</span>, <span class="ruby-value str">&quot;}&quot;</span>)
1365
- 255: <span class="ruby-identifier">regexp</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">escaped_pattern</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-identifier">variable_regexp</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
1366
- 256: <span class="ruby-identifier">capture_group</span> = <span class="ruby-value str">&quot;(.*)&quot;</span>
1367
- 257:
1368
- 258: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">processor</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
1369
- 259: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">processor</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:match</span>)
1370
- 260: <span class="ruby-identifier">name</span> = <span class="ruby-identifier">v</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-identifier">variable_regexp</span>).<span class="ruby-identifier">flatten</span>[<span class="ruby-value">0</span>]
1371
- 261: <span class="ruby-identifier">capture_group</span> = <span class="ruby-node">&quot;(#{processor.match(name)})&quot;</span>
1372
- 262: <span class="ruby-keyword kw">end</span>
1373
- 263: <span class="ruby-keyword kw">end</span>
1374
- 264:
1375
- 265: <span class="ruby-identifier">capture_group</span>
1376
- 266: <span class="ruby-keyword kw">end</span>)
1377
- 267: <span class="ruby-identifier">values</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-identifier">regexp</span>).<span class="ruby-identifier">flatten</span>
1378
- 268: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">variables</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">values</span>.<span class="ruby-identifier">size</span>
1379
- 269: <span class="ruby-keyword kw">for</span> <span class="ruby-identifier">i</span> <span class="ruby-keyword kw">in</span> <span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-identifier">variables</span>.<span class="ruby-identifier">size</span>
1380
- 270: <span class="ruby-identifier">name</span> = <span class="ruby-identifier">variables</span>[<span class="ruby-identifier">i</span>]
1381
- 271: <span class="ruby-identifier">value</span> = <span class="ruby-identifier">values</span>[<span class="ruby-identifier">i</span>]
1382
- 272:
1383
- 273: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">processor</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
1384
- 274: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">processor</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:restore</span>)
1385
- 275: <span class="ruby-identifier">value</span> = <span class="ruby-identifier">processor</span>.<span class="ruby-identifier">restore</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span>)
1386
- 276: <span class="ruby-keyword kw">end</span>
1387
- 277: <span class="ruby-keyword kw">end</span>
1388
- 278:
1389
- 279: <span class="ruby-identifier">mapping</span>[<span class="ruby-identifier">name</span>] = <span class="ruby-identifier">value</span>
1390
- 280: <span class="ruby-keyword kw">end</span>
1391
- 281: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">mapping</span>
1392
- 282: <span class="ruby-keyword kw">else</span>
1393
- 283: <span class="ruby-comment cmt"># Pattern failed to match URI.</span>
1394
- 284: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
1395
- 285: <span class="ruby-keyword kw">end</span>
1396
- 286: <span class="ruby-keyword kw">end</span>
1388
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 267</span>
1389
+ 267: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">extract_mapping</span>(<span class="ruby-identifier">pattern</span>, <span class="ruby-identifier">processor</span>=<span class="ruby-keyword kw">nil</span>)
1390
+ 268: <span class="ruby-identifier">mapping</span> = {}
1391
+ 269: <span class="ruby-identifier">variable_regexp</span> =
1392
+ 270: <span class="ruby-node">/\{([#{Addressable::URI::CharacterClasses::UNRESERVED}]+)\}/</span>
1393
+ 271: <span class="ruby-identifier">variables</span> = <span class="ruby-identifier">pattern</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-identifier">variable_regexp</span>).<span class="ruby-identifier">flatten</span>
1394
+ 272: <span class="ruby-identifier">variables</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">mapping</span>[<span class="ruby-identifier">v</span>] = <span class="ruby-value str">&quot;&quot;</span> }
1395
+ 273: <span class="ruby-identifier">escaped_pattern</span> =
1396
+ 274: <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">escape</span>(<span class="ruby-identifier">pattern</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\\\{/</span>, <span class="ruby-value str">&quot;{&quot;</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\\\}/</span>, <span class="ruby-value str">&quot;}&quot;</span>)
1397
+ 275: <span class="ruby-identifier">regexp</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">escaped_pattern</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-identifier">variable_regexp</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
1398
+ 276: <span class="ruby-identifier">capture_group</span> = <span class="ruby-value str">&quot;(.*)&quot;</span>
1399
+ 277:
1400
+ 278: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">processor</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
1401
+ 279: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">processor</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:match</span>)
1402
+ 280: <span class="ruby-identifier">name</span> = <span class="ruby-identifier">v</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-identifier">variable_regexp</span>).<span class="ruby-identifier">flatten</span>[<span class="ruby-value">0</span>]
1403
+ 281: <span class="ruby-identifier">capture_group</span> = <span class="ruby-node">&quot;(#{processor.match(name)})&quot;</span>
1404
+ 282: <span class="ruby-keyword kw">end</span>
1405
+ 283: <span class="ruby-keyword kw">end</span>
1406
+ 284:
1407
+ 285: <span class="ruby-identifier">capture_group</span>
1408
+ 286: <span class="ruby-keyword kw">end</span>)
1409
+ 287: <span class="ruby-identifier">values</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-identifier">regexp</span>).<span class="ruby-identifier">flatten</span>
1410
+ 288: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">variables</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">values</span>.<span class="ruby-identifier">size</span>
1411
+ 289: <span class="ruby-keyword kw">for</span> <span class="ruby-identifier">i</span> <span class="ruby-keyword kw">in</span> <span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-identifier">variables</span>.<span class="ruby-identifier">size</span>
1412
+ 290: <span class="ruby-identifier">name</span> = <span class="ruby-identifier">variables</span>[<span class="ruby-identifier">i</span>]
1413
+ 291: <span class="ruby-identifier">value</span> = <span class="ruby-identifier">values</span>[<span class="ruby-identifier">i</span>]
1414
+ 292:
1415
+ 293: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">processor</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
1416
+ 294: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">processor</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:restore</span>)
1417
+ 295: <span class="ruby-identifier">value</span> = <span class="ruby-identifier">processor</span>.<span class="ruby-identifier">restore</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span>)
1418
+ 296: <span class="ruby-keyword kw">end</span>
1419
+ 297: <span class="ruby-keyword kw">end</span>
1420
+ 298:
1421
+ 299: <span class="ruby-identifier">mapping</span>[<span class="ruby-identifier">name</span>] = <span class="ruby-identifier">value</span>
1422
+ 300: <span class="ruby-keyword kw">end</span>
1423
+ 301: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">mapping</span>
1424
+ 302: <span class="ruby-keyword kw">else</span>
1425
+ 303: <span class="ruby-comment cmt"># Pattern failed to match URI.</span>
1426
+ 304: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
1427
+ 305: <span class="ruby-keyword kw">end</span>
1428
+ 306: <span class="ruby-keyword kw">end</span>
1397
1429
  </pre>
1398
1430
  </div>
1399
1431
  </div>
1400
1432
  </div>
1401
1433
 
1402
- <div id="method-M000035" class="method-detail">
1403
- <a name="M000035"></a>
1434
+ <div id="method-M000036" class="method-detail">
1435
+ <a name="M000036"></a>
1404
1436
 
1405
1437
  <div class="method-heading">
1406
- <a href="#M000035" class="method-signature">
1438
+ <a href="#M000036" class="method-signature">
1407
1439
  <span class="method-name">fragment</span><span class="method-args">()</span>
1408
1440
  </a>
1409
1441
  </div>
1410
1442
 
1411
1443
  <div class="method-description">
1412
1444
  <p>
1413
- Returns the <a href="URI.html#M000035">fragment</a> for this <a
1445
+ Returns the <a href="URI.html#M000036">fragment</a> for this <a
1414
1446
  href="URI.html">URI</a>.
1415
1447
  </p>
1416
1448
  <p><a class="source-toggle" href="#"
1417
- onclick="toggleCode('M000035-source');return false;">[Source]</a></p>
1418
- <div class="method-source-code" id="M000035-source">
1449
+ onclick="toggleCode('M000036-source');return false;">[Source]</a></p>
1450
+ <div class="method-source-code" id="M000036-source">
1419
1451
  <pre>
1420
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 722</span>
1421
- 722: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fragment</span>
1422
- 723: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@fragment</span>
1423
- 724: <span class="ruby-keyword kw">end</span>
1452
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 740</span>
1453
+ 740: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fragment</span>
1454
+ 741: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@fragment</span>
1455
+ 742: <span class="ruby-keyword kw">end</span>
1424
1456
  </pre>
1425
1457
  </div>
1426
1458
  </div>
1427
1459
  </div>
1428
1460
 
1429
- <div id="method-M000036" class="method-detail">
1430
- <a name="M000036"></a>
1461
+ <div id="method-M000037" class="method-detail">
1462
+ <a name="M000037"></a>
1431
1463
 
1432
1464
  <div class="method-heading">
1433
- <a href="#M000036" class="method-signature">
1465
+ <a href="#M000037" class="method-signature">
1434
1466
  <span class="method-name">fragment=</span><span class="method-args">(new_fragment)</span>
1435
1467
  </a>
1436
1468
  </div>
1437
1469
 
1438
1470
  <div class="method-description">
1439
1471
  <p>
1440
- Sets the <a href="URI.html#M000035">fragment</a> for this <a
1472
+ Sets the <a href="URI.html#M000036">fragment</a> for this <a
1441
1473
  href="URI.html">URI</a>.
1442
1474
  </p>
1443
1475
  <p><a class="source-toggle" href="#"
1444
- onclick="toggleCode('M000036-source');return false;">[Source]</a></p>
1445
- <div class="method-source-code" id="M000036-source">
1476
+ onclick="toggleCode('M000037-source');return false;">[Source]</a></p>
1477
+ <div class="method-source-code" id="M000037-source">
1446
1478
  <pre>
1447
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 727</span>
1448
- 727: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fragment=</span>(<span class="ruby-identifier">new_fragment</span>)
1449
- 728: <span class="ruby-ivar">@fragment</span> = <span class="ruby-identifier">new_fragment</span>
1450
- 729: <span class="ruby-keyword kw">end</span>
1479
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 745</span>
1480
+ 745: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fragment=</span>(<span class="ruby-identifier">new_fragment</span>)
1481
+ 746: <span class="ruby-ivar">@fragment</span> = <span class="ruby-identifier">new_fragment</span>
1482
+ 747: <span class="ruby-keyword kw">end</span>
1451
1483
  </pre>
1452
1484
  </div>
1453
1485
  </div>
1454
1486
  </div>
1455
1487
 
1456
- <div id="method-M000020" class="method-detail">
1457
- <a name="M000020"></a>
1488
+ <div id="method-M000021" class="method-detail">
1489
+ <a name="M000021"></a>
1458
1490
 
1459
1491
  <div class="method-heading">
1460
- <a href="#M000020" class="method-signature">
1492
+ <a href="#M000021" class="method-signature">
1461
1493
  <span class="method-name">host</span><span class="method-args">()</span>
1462
1494
  </a>
1463
1495
  </div>
1464
1496
 
1465
1497
  <div class="method-description">
1466
1498
  <p>
1467
- Returns the <a href="URI.html#M000020">host</a> for this <a
1499
+ Returns the <a href="URI.html#M000021">host</a> for this <a
1468
1500
  href="URI.html">URI</a>.
1469
1501
  </p>
1470
1502
  <p><a class="source-toggle" href="#"
1471
- onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
1472
- <div class="method-source-code" id="M000020-source">
1503
+ onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
1504
+ <div class="method-source-code" id="M000021-source">
1473
1505
  <pre>
1474
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 563</span>
1475
- 563: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">host</span>
1476
- 564: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@host</span>
1477
- 565: <span class="ruby-keyword kw">end</span>
1506
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 582</span>
1507
+ 582: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">host</span>
1508
+ 583: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@host</span>
1509
+ 584: <span class="ruby-keyword kw">end</span>
1478
1510
  </pre>
1479
1511
  </div>
1480
1512
  </div>
1481
1513
  </div>
1482
1514
 
1483
- <div id="method-M000021" class="method-detail">
1484
- <a name="M000021"></a>
1515
+ <div id="method-M000022" class="method-detail">
1516
+ <a name="M000022"></a>
1485
1517
 
1486
1518
  <div class="method-heading">
1487
- <a href="#M000021" class="method-signature">
1519
+ <a href="#M000022" class="method-signature">
1488
1520
  <span class="method-name">host=</span><span class="method-args">(new_host)</span>
1489
1521
  </a>
1490
1522
  </div>
1491
1523
 
1492
1524
  <div class="method-description">
1493
1525
  <p>
1494
- Sets the <a href="URI.html#M000020">host</a> for this <a
1526
+ Sets the <a href="URI.html#M000021">host</a> for this <a
1495
1527
  href="URI.html">URI</a>.
1496
1528
  </p>
1497
1529
  <p><a class="source-toggle" href="#"
1498
- onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
1499
- <div class="method-source-code" id="M000021-source">
1530
+ onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
1531
+ <div class="method-source-code" id="M000022-source">
1500
1532
  <pre>
1501
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 568</span>
1502
- 568: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">host=</span>(<span class="ruby-identifier">new_host</span>)
1503
- 569: <span class="ruby-ivar">@host</span> = <span class="ruby-identifier">new_host</span>
1504
- 570:
1505
- 571: <span class="ruby-comment cmt"># Reset dependant values</span>
1506
- 572: <span class="ruby-ivar">@authority</span> = <span class="ruby-keyword kw">nil</span>
1507
- 573:
1508
- 574: <span class="ruby-comment cmt"># Ensure we haven't created an invalid URI</span>
1509
- 575: <span class="ruby-identifier">validate</span>()
1510
- 576: <span class="ruby-keyword kw">end</span>
1533
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 587</span>
1534
+ 587: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">host=</span>(<span class="ruby-identifier">new_host</span>)
1535
+ 588: <span class="ruby-ivar">@host</span> = <span class="ruby-identifier">new_host</span>
1536
+ 589:
1537
+ 590: <span class="ruby-comment cmt"># Reset dependant values</span>
1538
+ 591: <span class="ruby-ivar">@authority</span> = <span class="ruby-keyword kw">nil</span>
1539
+ 592:
1540
+ 593: <span class="ruby-comment cmt"># Ensure we haven't created an invalid URI</span>
1541
+ 594: <span class="ruby-identifier">validate</span>()
1542
+ 595: <span class="ruby-keyword kw">end</span>
1511
1543
  </pre>
1512
1544
  </div>
1513
1545
  </div>
1514
1546
  </div>
1515
1547
 
1516
- <div id="method-M000056" class="method-detail">
1517
- <a name="M000056"></a>
1548
+ <div id="method-M000057" class="method-detail">
1549
+ <a name="M000057"></a>
1518
1550
 
1519
1551
  <div class="method-heading">
1520
- <a href="#M000056" class="method-signature">
1552
+ <a href="#M000057" class="method-signature">
1521
1553
  <span class="method-name">inspect</span><span class="method-args">()</span>
1522
1554
  </a>
1523
1555
  </div>
@@ -1528,23 +1560,23 @@ Returns a string representation of the <a href="URI.html">URI</a>
1528
1560
  object&#8216;s state.
1529
1561
  </p>
1530
1562
  <p><a class="source-toggle" href="#"
1531
- onclick="toggleCode('M000056-source');return false;">[Source]</a></p>
1532
- <div class="method-source-code" id="M000056-source">
1563
+ onclick="toggleCode('M000057-source');return false;">[Source]</a></p>
1564
+ <div class="method-source-code" id="M000057-source">
1533
1565
  <pre>
1534
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 1093</span>
1535
- 1093: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">inspect</span>
1536
- 1094: <span class="ruby-identifier">sprintf</span>(<span class="ruby-value str">&quot;#&lt;%s:%#0x URI:%s&gt;&quot;</span>, <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">object_id</span>, <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_s</span>)
1537
- 1095: <span class="ruby-keyword kw">end</span>
1566
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 1104</span>
1567
+ 1104: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">inspect</span>
1568
+ 1105: <span class="ruby-identifier">sprintf</span>(<span class="ruby-value str">&quot;#&lt;%s:%#0x URI:%s&gt;&quot;</span>, <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">object_id</span>, <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_s</span>)
1569
+ 1106: <span class="ruby-keyword kw">end</span>
1538
1570
  </pre>
1539
1571
  </div>
1540
1572
  </div>
1541
1573
  </div>
1542
1574
 
1543
- <div id="method-M000037" class="method-detail">
1544
- <a name="M000037"></a>
1575
+ <div id="method-M000038" class="method-detail">
1576
+ <a name="M000038"></a>
1545
1577
 
1546
1578
  <div class="method-heading">
1547
- <a href="#M000037" class="method-signature">
1579
+ <a href="#M000038" class="method-signature">
1548
1580
  <span class="method-name">ip_based?</span><span class="method-args">()</span>
1549
1581
  </a>
1550
1582
  </div>
@@ -1554,21 +1586,24 @@ object&#8216;s state.
1554
1586
  Returns true if the <a href="URI.html">URI</a> uses an IP-based protocol.
1555
1587
  </p>
1556
1588
  <p><a class="source-toggle" href="#"
1557
- onclick="toggleCode('M000037-source');return false;">[Source]</a></p>
1558
- <div class="method-source-code" id="M000037-source">
1589
+ onclick="toggleCode('M000038-source');return false;">[Source]</a></p>
1590
+ <div class="method-source-code" id="M000038-source">
1559
1591
  <pre>
1560
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 732</span>
1561
- 732: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ip_based?</span>
1562
- 733: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">scheme</span>.<span class="ruby-identifier">nil?</span>
1563
- 734: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">ip_based_schemes</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">scheme</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">downcase</span>)
1564
- 735: <span class="ruby-keyword kw">end</span>
1592
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 750</span>
1593
+ 750: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ip_based?</span>
1594
+ 751: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">scheme</span>
1595
+ 752: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">ip_based_schemes</span>.<span class="ruby-identifier">include?</span>(
1596
+ 753: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">scheme</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">downcase</span>)
1597
+ 754: <span class="ruby-keyword kw">end</span>
1598
+ 755: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
1599
+ 756: <span class="ruby-keyword kw">end</span>
1565
1600
  </pre>
1566
1601
  </div>
1567
1602
  </div>
1568
1603
  </div>
1569
1604
 
1570
- <div id="method-M000042" class="method-detail">
1571
- <a name="M000042"></a>
1605
+ <div id="method-M000043" class="method-detail">
1606
+ <a name="M000043"></a>
1572
1607
 
1573
1608
  <div class="method-heading">
1574
1609
  <span class="method-name">join</span><span class="method-args">(uri)</span>
@@ -1576,13 +1611,13 @@ Returns true if the <a href="URI.html">URI</a> uses an IP-based protocol.
1576
1611
 
1577
1612
  <div class="method-description">
1578
1613
  <p>
1579
- Alias for <a href="URI.html#M000041">merge</a>
1614
+ Alias for <a href="URI.html#M000042">merge</a>
1580
1615
  </p>
1581
1616
  </div>
1582
1617
  </div>
1583
1618
 
1584
- <div id="method-M000044" class="method-detail">
1585
- <a name="M000044"></a>
1619
+ <div id="method-M000045" class="method-detail">
1620
+ <a name="M000045"></a>
1586
1621
 
1587
1622
  <div class="method-heading">
1588
1623
  <span class="method-name">join!</span><span class="method-args">(uri)</span>
@@ -1590,16 +1625,16 @@ Alias for <a href="URI.html#M000041">merge</a>
1590
1625
 
1591
1626
  <div class="method-description">
1592
1627
  <p>
1593
- Alias for <a href="URI.html#M000041">merge</a>!
1628
+ Alias for <a href="URI.html#M000042">merge</a>!
1594
1629
  </p>
1595
1630
  </div>
1596
1631
  </div>
1597
1632
 
1598
- <div id="method-M000041" class="method-detail">
1599
- <a name="M000041"></a>
1633
+ <div id="method-M000042" class="method-detail">
1634
+ <a name="M000042"></a>
1600
1635
 
1601
1636
  <div class="method-heading">
1602
- <a href="#M000041" class="method-signature">
1637
+ <a href="#M000042" class="method-signature">
1603
1638
  <span class="method-name">merge</span><span class="method-args">(uri)</span>
1604
1639
  </a>
1605
1640
  </div>
@@ -1609,49 +1644,49 @@ Alias for <a href="URI.html#M000041">merge</a>!
1609
1644
  Merges two URIs together.
1610
1645
  </p>
1611
1646
  <p><a class="source-toggle" href="#"
1612
- onclick="toggleCode('M000041-source');return false;">[Source]</a></p>
1613
- <div class="method-source-code" id="M000041-source">
1647
+ onclick="toggleCode('M000042-source');return false;">[Source]</a></p>
1648
+ <div class="method-source-code" id="M000042-source">
1614
1649
  <pre>
1615
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 839</span>
1616
- 839: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">merge</span>(<span class="ruby-identifier">uri</span>)
1617
- 840: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">uri</span>
1618
- 841: <span class="ruby-keyword kw">end</span>
1650
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 860</span>
1651
+ 860: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">merge</span>(<span class="ruby-identifier">uri</span>)
1652
+ 861: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">uri</span>
1653
+ 862: <span class="ruby-keyword kw">end</span>
1619
1654
  </pre>
1620
1655
  </div>
1621
1656
  </div>
1622
1657
  </div>
1623
1658
 
1624
- <div id="method-M000043" class="method-detail">
1625
- <a name="M000043"></a>
1659
+ <div id="method-M000044" class="method-detail">
1660
+ <a name="M000044"></a>
1626
1661
 
1627
1662
  <div class="method-heading">
1628
- <a href="#M000043" class="method-signature">
1663
+ <a href="#M000044" class="method-signature">
1629
1664
  <span class="method-name">merge!</span><span class="method-args">(uri)</span>
1630
1665
  </a>
1631
1666
  </div>
1632
1667
 
1633
1668
  <div class="method-description">
1634
1669
  <p>
1635
- Destructive form of <a href="URI.html#M000041">merge</a>.
1670
+ Destructive form of <a href="URI.html#M000042">merge</a>.
1636
1671
  </p>
1637
1672
  <p><a class="source-toggle" href="#"
1638
- onclick="toggleCode('M000043-source');return false;">[Source]</a></p>
1639
- <div class="method-source-code" id="M000043-source">
1673
+ onclick="toggleCode('M000044-source');return false;">[Source]</a></p>
1674
+ <div class="method-source-code" id="M000044-source">
1640
1675
  <pre>
1641
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 845</span>
1642
- 845: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">merge!</span>(<span class="ruby-identifier">uri</span>)
1643
- 846: <span class="ruby-identifier">replace_self</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">uri</span>))
1644
- 847: <span class="ruby-keyword kw">end</span>
1676
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 866</span>
1677
+ 866: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">merge!</span>(<span class="ruby-identifier">uri</span>)
1678
+ 867: <span class="ruby-identifier">replace_self</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">uri</span>))
1679
+ 868: <span class="ruby-keyword kw">end</span>
1645
1680
  </pre>
1646
1681
  </div>
1647
1682
  </div>
1648
1683
  </div>
1649
1684
 
1650
- <div id="method-M000047" class="method-detail">
1651
- <a name="M000047"></a>
1685
+ <div id="method-M000048" class="method-detail">
1686
+ <a name="M000048"></a>
1652
1687
 
1653
1688
  <div class="method-heading">
1654
- <a href="#M000047" class="method-signature">
1689
+ <a href="#M000048" class="method-signature">
1655
1690
  <span class="method-name">normalize</span><span class="method-args">()</span>
1656
1691
  </a>
1657
1692
  </div>
@@ -1668,91 +1703,88 @@ different URIs may represent the same resource and should not be cached
1668
1703
  multiple times.
1669
1704
  </p>
1670
1705
  <p><a class="source-toggle" href="#"
1671
- onclick="toggleCode('M000047-source');return false;">[Source]</a></p>
1672
- <div class="method-source-code" id="M000047-source">
1706
+ onclick="toggleCode('M000048-source');return false;">[Source]</a></p>
1707
+ <div class="method-source-code" id="M000048-source">
1673
1708
  <pre>
1674
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 913</span>
1675
- 913: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">normalize</span>
1676
- 914: <span class="ruby-identifier">normalized_scheme</span> = <span class="ruby-keyword kw">nil</span>
1677
- 915: <span class="ruby-identifier">normalized_scheme</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">scheme</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">downcase</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
1678
- 916: <span class="ruby-identifier">normalized_scheme</span> = <span class="ruby-value str">&quot;svn+ssh&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">normalized_scheme</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;ssh+svn&quot;</span>
1679
- 917: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">normalized_scheme</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;feed&quot;</span>
1680
- 918: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^feed:\/*http:\/*/</span>
1681
- 919: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">parse</span>(
1682
- 920: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/^feed:\/*(http:\/*.*)/</span>).<span class="ruby-identifier">flatten</span>[<span class="ruby-value">0</span>]).<span class="ruby-identifier">normalize</span>
1683
- 921: <span class="ruby-keyword kw">end</span>
1684
- 922: <span class="ruby-keyword kw">end</span>
1685
- 923: <span class="ruby-identifier">normalized_user</span> = <span class="ruby-keyword kw">nil</span>
1686
- 924: <span class="ruby-identifier">normalized_user</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">user</span>.<span class="ruby-identifier">strip</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">user</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
1687
- 925: <span class="ruby-identifier">normalized_password</span> = <span class="ruby-keyword kw">nil</span>
1688
- 926: <span class="ruby-identifier">normalized_password</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">password</span>.<span class="ruby-identifier">strip</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">password</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
1689
- 927:
1690
- 928: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">normalized_scheme</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/https?/</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">normalized_user</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;&quot;</span> <span class="ruby-operator">&amp;&amp;</span>
1691
- 929: (<span class="ruby-identifier">normalized_password</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">normalized_password</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;&quot;</span>)
1692
- 930: <span class="ruby-identifier">normalized_user</span> = <span class="ruby-keyword kw">nil</span>
1693
- 931: <span class="ruby-identifier">normalized_password</span> = <span class="ruby-keyword kw">nil</span>
1694
- 932: <span class="ruby-keyword kw">end</span>
1695
- 933:
1696
- 934: <span class="ruby-identifier">normalized_host</span> = <span class="ruby-keyword kw">nil</span>
1697
- 935: <span class="ruby-identifier">normalized_host</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">host</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">downcase</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">host</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
1698
- 936: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">normalized_host</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
1699
- 937: <span class="ruby-keyword kw">begin</span>
1700
- 938: <span class="ruby-identifier">normalized_host</span> = <span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">IDNA</span>.<span class="ruby-identifier">to_ascii</span>(<span class="ruby-identifier">normalized_host</span>)
1701
- 939: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span>
1702
- 940: <span class="ruby-keyword kw">nil</span>
1703
- 941: <span class="ruby-keyword kw">end</span>
1704
- 942: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">normalized_host</span>[<span class="ruby-value">-1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;.&quot;</span>
1705
- 943: <span class="ruby-identifier">normalized_host</span> = <span class="ruby-identifier">normalized_host</span>[<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-value">-1</span>]
1706
- 944: <span class="ruby-keyword kw">end</span>
1707
- 945: <span class="ruby-keyword kw">end</span>
1708
- 946:
1709
- 947: <span class="ruby-identifier">normalized_port</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">port</span>
1710
- 948: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">scheme_mapping</span>[<span class="ruby-identifier">normalized_scheme</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">normalized_port</span>
1711
- 949: <span class="ruby-identifier">normalized_port</span> = <span class="ruby-keyword kw">nil</span>
1712
- 950: <span class="ruby-keyword kw">end</span>
1713
- 951: <span class="ruby-identifier">normalized_path</span> = <span class="ruby-keyword kw">nil</span>
1714
- 952: <span class="ruby-identifier">normalized_path</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">path</span>.<span class="ruby-identifier">strip</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">path</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
1715
- 953: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">normalized_path</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-operator">&amp;&amp;</span>
1716
- 954: <span class="ruby-identifier">normalized_scheme</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-operator">&amp;&amp;</span>
1717
- 955: <span class="ruby-identifier">normalized_host</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
1718
- 956: <span class="ruby-identifier">normalized_path</span> = <span class="ruby-value str">&quot;/&quot;</span>
1719
- 957: <span class="ruby-keyword kw">end</span>
1720
- 958: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">normalized_path</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
1721
- 959: <span class="ruby-identifier">normalized_path</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">normalize_path</span>(<span class="ruby-identifier">normalized_path</span>)
1722
- 960: <span class="ruby-keyword kw">end</span>
1723
- 961: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">normalized_path</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;&quot;</span>
1724
- 962: <span class="ruby-keyword kw">if</span> [<span class="ruby-value str">&quot;http&quot;</span>, <span class="ruby-value str">&quot;https&quot;</span>, <span class="ruby-value str">&quot;ftp&quot;</span>, <span class="ruby-value str">&quot;tftp&quot;</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">normalized_scheme</span>)
1725
- 963: <span class="ruby-identifier">normalized_path</span> = <span class="ruby-value str">&quot;/&quot;</span>
1726
- 964: <span class="ruby-keyword kw">end</span>
1727
- 965: <span class="ruby-keyword kw">end</span>
1728
- 966:
1729
- 967: <span class="ruby-identifier">normalized_query</span> = <span class="ruby-keyword kw">nil</span>
1730
- 968: <span class="ruby-identifier">normalized_query</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">query</span>.<span class="ruby-identifier">strip</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">query</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
1731
- 969:
1732
- 970: <span class="ruby-identifier">normalized_fragment</span> = <span class="ruby-keyword kw">nil</span>
1733
- 971: <span class="ruby-identifier">normalized_fragment</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fragment</span>.<span class="ruby-identifier">strip</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fragment</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
1734
- 972: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(
1735
- 973: <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span>.<span class="ruby-identifier">normalized_encode</span>(<span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span>.<span class="ruby-identifier">new</span>(
1736
- 974: <span class="ruby-identifier">normalized_scheme</span>,
1737
- 975: <span class="ruby-identifier">normalized_user</span>,
1738
- 976: <span class="ruby-identifier">normalized_password</span>,
1739
- 977: <span class="ruby-identifier">normalized_host</span>,
1740
- 978: <span class="ruby-identifier">normalized_port</span>,
1741
- 979: <span class="ruby-identifier">normalized_path</span>,
1742
- 980: <span class="ruby-identifier">normalized_query</span>,
1743
- 981: <span class="ruby-identifier">normalized_fragment</span>
1744
- 982: )))
1745
- 983: <span class="ruby-keyword kw">end</span>
1709
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 937</span>
1710
+ 937: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">normalize</span>
1711
+ 938: <span class="ruby-identifier">normalized_scheme</span> = <span class="ruby-keyword kw">nil</span>
1712
+ 939: <span class="ruby-identifier">normalized_scheme</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">scheme</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">downcase</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
1713
+ 940: <span class="ruby-identifier">normalized_scheme</span> = <span class="ruby-value str">&quot;svn+ssh&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">normalized_scheme</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;ssh+svn&quot;</span>
1714
+ 941: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">normalized_scheme</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;feed&quot;</span>
1715
+ 942: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^feed:\/*http:\/*/</span>
1716
+ 943: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">parse</span>(
1717
+ 944: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/^feed:\/*(http:\/*.*)/</span>).<span class="ruby-identifier">flatten</span>[<span class="ruby-value">0</span>]).<span class="ruby-identifier">normalize</span>
1718
+ 945: <span class="ruby-keyword kw">end</span>
1719
+ 946: <span class="ruby-keyword kw">end</span>
1720
+ 947: <span class="ruby-identifier">normalized_user</span> = <span class="ruby-keyword kw">nil</span>
1721
+ 948: <span class="ruby-identifier">normalized_user</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">user</span>.<span class="ruby-identifier">strip</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">user</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
1722
+ 949: <span class="ruby-identifier">normalized_password</span> = <span class="ruby-keyword kw">nil</span>
1723
+ 950: <span class="ruby-identifier">normalized_password</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">password</span>.<span class="ruby-identifier">strip</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">password</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
1724
+ 951:
1725
+ 952: <span class="ruby-comment cmt"># If we are using http or https and user/password are blank,</span>
1726
+ 953: <span class="ruby-comment cmt"># then we remove them</span>
1727
+ 954: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">normalized_scheme</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/https?/</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">normalized_user</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;&quot;</span> <span class="ruby-operator">&amp;&amp;</span>
1728
+ 955: (<span class="ruby-operator">!</span><span class="ruby-identifier">normalized_password</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">normalized_password</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;&quot;</span>)
1729
+ 956: <span class="ruby-identifier">normalized_user</span> = <span class="ruby-keyword kw">nil</span>
1730
+ 957: <span class="ruby-identifier">normalized_password</span> = <span class="ruby-keyword kw">nil</span>
1731
+ 958: <span class="ruby-keyword kw">end</span>
1732
+ 959:
1733
+ 960: <span class="ruby-identifier">normalized_host</span> = <span class="ruby-keyword kw">nil</span>
1734
+ 961: <span class="ruby-identifier">normalized_host</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">host</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">downcase</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">host</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
1735
+ 962: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">normalized_host</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
1736
+ 963: <span class="ruby-keyword kw">begin</span>
1737
+ 964: <span class="ruby-identifier">normalized_host</span> = <span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">IDNA</span>.<span class="ruby-identifier">to_ascii</span>(<span class="ruby-identifier">normalized_host</span>)
1738
+ 965: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span>
1739
+ 966: <span class="ruby-keyword kw">nil</span>
1740
+ 967: <span class="ruby-keyword kw">end</span>
1741
+ 968: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">normalized_host</span>[<span class="ruby-value">-1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;.&quot;</span>
1742
+ 969: <span class="ruby-identifier">normalized_host</span> = <span class="ruby-identifier">normalized_host</span>[<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-value">-1</span>]
1743
+ 970: <span class="ruby-keyword kw">end</span>
1744
+ 971: <span class="ruby-keyword kw">end</span>
1745
+ 972:
1746
+ 973: <span class="ruby-identifier">normalized_port</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">port</span>
1747
+ 974: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">scheme_mapping</span>[<span class="ruby-identifier">normalized_scheme</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">normalized_port</span>
1748
+ 975: <span class="ruby-identifier">normalized_port</span> = <span class="ruby-keyword kw">nil</span>
1749
+ 976: <span class="ruby-keyword kw">end</span>
1750
+ 977: <span class="ruby-identifier">normalized_path</span> = <span class="ruby-keyword kw">nil</span>
1751
+ 978: <span class="ruby-identifier">normalized_path</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">path</span>.<span class="ruby-identifier">strip</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">path</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
1752
+ 979: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">normalized_path</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
1753
+ 980: <span class="ruby-identifier">normalized_path</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">normalize_path</span>(<span class="ruby-identifier">normalized_path</span>)
1754
+ 981: <span class="ruby-keyword kw">end</span>
1755
+ 982: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">normalized_path</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;&quot;</span>
1756
+ 983: <span class="ruby-keyword kw">if</span> [<span class="ruby-value str">&quot;http&quot;</span>, <span class="ruby-value str">&quot;https&quot;</span>, <span class="ruby-value str">&quot;ftp&quot;</span>, <span class="ruby-value str">&quot;tftp&quot;</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">normalized_scheme</span>)
1757
+ 984: <span class="ruby-identifier">normalized_path</span> = <span class="ruby-value str">&quot;/&quot;</span>
1758
+ 985: <span class="ruby-keyword kw">end</span>
1759
+ 986: <span class="ruby-keyword kw">end</span>
1760
+ 987:
1761
+ 988: <span class="ruby-identifier">normalized_query</span> = <span class="ruby-keyword kw">nil</span>
1762
+ 989: <span class="ruby-identifier">normalized_query</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">query</span>.<span class="ruby-identifier">strip</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">query</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
1763
+ 990:
1764
+ 991: <span class="ruby-identifier">normalized_fragment</span> = <span class="ruby-keyword kw">nil</span>
1765
+ 992: <span class="ruby-identifier">normalized_fragment</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fragment</span>.<span class="ruby-identifier">strip</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fragment</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
1766
+ 993: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(
1767
+ 994: <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span>.<span class="ruby-identifier">normalized_encode</span>(<span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span>.<span class="ruby-identifier">new</span>(
1768
+ 995: <span class="ruby-identifier">normalized_scheme</span>,
1769
+ 996: <span class="ruby-identifier">normalized_user</span>,
1770
+ 997: <span class="ruby-identifier">normalized_password</span>,
1771
+ 998: <span class="ruby-identifier">normalized_host</span>,
1772
+ 999: <span class="ruby-identifier">normalized_port</span>,
1773
+ 1000: <span class="ruby-identifier">normalized_path</span>,
1774
+ 1001: <span class="ruby-identifier">normalized_query</span>,
1775
+ 1002: <span class="ruby-identifier">normalized_fragment</span>
1776
+ 1003: )))
1777
+ 1004: <span class="ruby-keyword kw">end</span>
1746
1778
  </pre>
1747
1779
  </div>
1748
1780
  </div>
1749
1781
  </div>
1750
1782
 
1751
- <div id="method-M000048" class="method-detail">
1752
- <a name="M000048"></a>
1783
+ <div id="method-M000049" class="method-detail">
1784
+ <a name="M000049"></a>
1753
1785
 
1754
1786
  <div class="method-heading">
1755
- <a href="#M000048" class="method-signature">
1787
+ <a href="#M000049" class="method-signature">
1756
1788
  <span class="method-name">normalize!</span><span class="method-args">()</span>
1757
1789
  </a>
1758
1790
  </div>
@@ -1762,268 +1794,268 @@ multiple times.
1762
1794
  Destructively normalizes this <a href="URI.html">URI</a> object.
1763
1795
  </p>
1764
1796
  <p><a class="source-toggle" href="#"
1765
- onclick="toggleCode('M000048-source');return false;">[Source]</a></p>
1766
- <div class="method-source-code" id="M000048-source">
1797
+ onclick="toggleCode('M000049-source');return false;">[Source]</a></p>
1798
+ <div class="method-source-code" id="M000049-source">
1767
1799
  <pre>
1768
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 986</span>
1769
- 986: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">normalize!</span>
1770
- 987: <span class="ruby-identifier">replace_self</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">normalize</span>)
1771
- 988: <span class="ruby-keyword kw">end</span>
1800
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 1007</span>
1801
+ 1007: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">normalize!</span>
1802
+ 1008: <span class="ruby-identifier">replace_self</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">normalize</span>)
1803
+ 1009: <span class="ruby-keyword kw">end</span>
1772
1804
  </pre>
1773
1805
  </div>
1774
1806
  </div>
1775
1807
  </div>
1776
1808
 
1777
- <div id="method-M000016" class="method-detail">
1778
- <a name="M000016"></a>
1809
+ <div id="method-M000017" class="method-detail">
1810
+ <a name="M000017"></a>
1779
1811
 
1780
1812
  <div class="method-heading">
1781
- <a href="#M000016" class="method-signature">
1813
+ <a href="#M000017" class="method-signature">
1782
1814
  <span class="method-name">password</span><span class="method-args">()</span>
1783
1815
  </a>
1784
1816
  </div>
1785
1817
 
1786
1818
  <div class="method-description">
1787
1819
  <p>
1788
- Returns the <a href="URI.html#M000016">password</a> for this <a
1820
+ Returns the <a href="URI.html#M000017">password</a> for this <a
1789
1821
  href="URI.html">URI</a>.
1790
1822
  </p>
1791
1823
  <p><a class="source-toggle" href="#"
1792
- onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
1793
- <div class="method-source-code" id="M000016-source">
1824
+ onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
1825
+ <div class="method-source-code" id="M000017-source">
1794
1826
  <pre>
1795
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 509</span>
1796
- 509: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">password</span>
1797
- 510: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@password</span>
1798
- 511: <span class="ruby-keyword kw">end</span>
1827
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 528</span>
1828
+ 528: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">password</span>
1829
+ 529: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@password</span>
1830
+ 530: <span class="ruby-keyword kw">end</span>
1799
1831
  </pre>
1800
1832
  </div>
1801
1833
  </div>
1802
1834
  </div>
1803
1835
 
1804
- <div id="method-M000017" class="method-detail">
1805
- <a name="M000017"></a>
1836
+ <div id="method-M000018" class="method-detail">
1837
+ <a name="M000018"></a>
1806
1838
 
1807
1839
  <div class="method-heading">
1808
- <a href="#M000017" class="method-signature">
1840
+ <a href="#M000018" class="method-signature">
1809
1841
  <span class="method-name">password=</span><span class="method-args">(new_password)</span>
1810
1842
  </a>
1811
1843
  </div>
1812
1844
 
1813
1845
  <div class="method-description">
1814
1846
  <p>
1815
- Sets the <a href="URI.html#M000016">password</a> for this <a
1847
+ Sets the <a href="URI.html#M000017">password</a> for this <a
1816
1848
  href="URI.html">URI</a>.
1817
1849
  </p>
1818
1850
  <p><a class="source-toggle" href="#"
1819
- onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
1820
- <div class="method-source-code" id="M000017-source">
1851
+ onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
1852
+ <div class="method-source-code" id="M000018-source">
1821
1853
  <pre>
1822
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 514</span>
1823
- 514: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">password=</span>(<span class="ruby-identifier">new_password</span>)
1824
- 515: <span class="ruby-ivar">@password</span> = <span class="ruby-identifier">new_password</span>
1825
- 516:
1826
- 517: <span class="ruby-comment cmt"># You can't have a nil user with a non-nil password</span>
1827
- 518: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@password</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
1828
- 519: <span class="ruby-ivar">@user</span> = <span class="ruby-value str">&quot;&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@user</span>.<span class="ruby-identifier">nil?</span>
1829
- 520: <span class="ruby-keyword kw">end</span>
1830
- 521:
1831
- 522: <span class="ruby-comment cmt"># Reset dependant values</span>
1832
- 523: <span class="ruby-ivar">@userinfo</span> = <span class="ruby-keyword kw">nil</span>
1833
- 524: <span class="ruby-ivar">@authority</span> = <span class="ruby-keyword kw">nil</span>
1834
- 525:
1835
- 526: <span class="ruby-comment cmt"># Ensure we haven't created an invalid URI</span>
1836
- 527: <span class="ruby-identifier">validate</span>()
1837
- 528: <span class="ruby-keyword kw">end</span>
1854
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 533</span>
1855
+ 533: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">password=</span>(<span class="ruby-identifier">new_password</span>)
1856
+ 534: <span class="ruby-ivar">@password</span> = <span class="ruby-identifier">new_password</span>
1857
+ 535:
1858
+ 536: <span class="ruby-comment cmt"># You can't have a nil user with a non-nil password</span>
1859
+ 537: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@password</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
1860
+ 538: <span class="ruby-ivar">@user</span> = <span class="ruby-value str">&quot;&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@user</span>.<span class="ruby-identifier">nil?</span>
1861
+ 539: <span class="ruby-keyword kw">end</span>
1862
+ 540:
1863
+ 541: <span class="ruby-comment cmt"># Reset dependant values</span>
1864
+ 542: <span class="ruby-ivar">@userinfo</span> = <span class="ruby-keyword kw">nil</span>
1865
+ 543: <span class="ruby-ivar">@authority</span> = <span class="ruby-keyword kw">nil</span>
1866
+ 544:
1867
+ 545: <span class="ruby-comment cmt"># Ensure we haven't created an invalid URI</span>
1868
+ 546: <span class="ruby-identifier">validate</span>()
1869
+ 547: <span class="ruby-keyword kw">end</span>
1838
1870
  </pre>
1839
1871
  </div>
1840
1872
  </div>
1841
1873
  </div>
1842
1874
 
1843
- <div id="method-M000029" class="method-detail">
1844
- <a name="M000029"></a>
1875
+ <div id="method-M000030" class="method-detail">
1876
+ <a name="M000030"></a>
1845
1877
 
1846
1878
  <div class="method-heading">
1847
- <a href="#M000029" class="method-signature">
1879
+ <a href="#M000030" class="method-signature">
1848
1880
  <span class="method-name">path</span><span class="method-args">()</span>
1849
1881
  </a>
1850
1882
  </div>
1851
1883
 
1852
1884
  <div class="method-description">
1853
1885
  <p>
1854
- Returns the <a href="URI.html#M000029">path</a> for this <a
1886
+ Returns the <a href="URI.html#M000030">path</a> for this <a
1855
1887
  href="URI.html">URI</a>.
1856
1888
  </p>
1857
1889
  <p><a class="source-toggle" href="#"
1858
- onclick="toggleCode('M000029-source');return false;">[Source]</a></p>
1859
- <div class="method-source-code" id="M000029-source">
1890
+ onclick="toggleCode('M000030-source');return false;">[Source]</a></p>
1891
+ <div class="method-source-code" id="M000030-source">
1860
1892
  <pre>
1861
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 687</span>
1862
- 687: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">path</span>
1863
- 688: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@path</span>
1864
- 689: <span class="ruby-keyword kw">end</span>
1893
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 705</span>
1894
+ 705: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">path</span>
1895
+ 706: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@path</span>
1896
+ 707: <span class="ruby-keyword kw">end</span>
1865
1897
  </pre>
1866
1898
  </div>
1867
1899
  </div>
1868
1900
  </div>
1869
1901
 
1870
- <div id="method-M000030" class="method-detail">
1871
- <a name="M000030"></a>
1902
+ <div id="method-M000031" class="method-detail">
1903
+ <a name="M000031"></a>
1872
1904
 
1873
1905
  <div class="method-heading">
1874
- <a href="#M000030" class="method-signature">
1906
+ <a href="#M000031" class="method-signature">
1875
1907
  <span class="method-name">path=</span><span class="method-args">(new_path)</span>
1876
1908
  </a>
1877
1909
  </div>
1878
1910
 
1879
1911
  <div class="method-description">
1880
1912
  <p>
1881
- Sets the <a href="URI.html#M000029">path</a> for this <a
1913
+ Sets the <a href="URI.html#M000030">path</a> for this <a
1882
1914
  href="URI.html">URI</a>.
1883
1915
  </p>
1884
1916
  <p><a class="source-toggle" href="#"
1885
- onclick="toggleCode('M000030-source');return false;">[Source]</a></p>
1886
- <div class="method-source-code" id="M000030-source">
1917
+ onclick="toggleCode('M000031-source');return false;">[Source]</a></p>
1918
+ <div class="method-source-code" id="M000031-source">
1887
1919
  <pre>
1888
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 692</span>
1889
- 692: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">path=</span>(<span class="ruby-identifier">new_path</span>)
1890
- 693: <span class="ruby-ivar">@path</span> = <span class="ruby-identifier">new_path</span>
1891
- 694: <span class="ruby-keyword kw">end</span>
1920
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 710</span>
1921
+ 710: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">path=</span>(<span class="ruby-identifier">new_path</span>)
1922
+ 711: <span class="ruby-ivar">@path</span> = (<span class="ruby-identifier">new_path</span> <span class="ruby-operator">||</span> <span class="ruby-value str">&quot;&quot;</span>)
1923
+ 712: <span class="ruby-keyword kw">end</span>
1892
1924
  </pre>
1893
1925
  </div>
1894
1926
  </div>
1895
1927
  </div>
1896
1928
 
1897
- <div id="method-M000026" class="method-detail">
1898
- <a name="M000026"></a>
1929
+ <div id="method-M000027" class="method-detail">
1930
+ <a name="M000027"></a>
1899
1931
 
1900
1932
  <div class="method-heading">
1901
- <a href="#M000026" class="method-signature">
1933
+ <a href="#M000027" class="method-signature">
1902
1934
  <span class="method-name">port</span><span class="method-args">()</span>
1903
1935
  </a>
1904
1936
  </div>
1905
1937
 
1906
1938
  <div class="method-description">
1907
1939
  <p>
1908
- Returns the <a href="URI.html#M000026">port</a> number for this <a
1940
+ Returns the <a href="URI.html#M000027">port</a> number for this <a
1909
1941
  href="URI.html">URI</a>. This method will <a
1910
- href="URI.html#M000047">normalize</a> to the default <a
1911
- href="URI.html#M000026">port</a> for the <a href="URI.html">URI</a>&#8216;s
1912
- <a href="URI.html#M000012">scheme</a> if the <a
1913
- href="URI.html#M000026">port</a> isn&#8216;t explicitly specified in the <a
1942
+ href="URI.html#M000048">normalize</a> to the default <a
1943
+ href="URI.html#M000027">port</a> for the <a href="URI.html">URI</a>&#8216;s
1944
+ <a href="URI.html#M000013">scheme</a> if the <a
1945
+ href="URI.html#M000027">port</a> isn&#8216;t explicitly specified in the <a
1914
1946
  href="URI.html">URI</a>.
1915
1947
  </p>
1916
1948
  <p><a class="source-toggle" href="#"
1917
- onclick="toggleCode('M000026-source');return false;">[Source]</a></p>
1918
- <div class="method-source-code" id="M000026-source">
1949
+ onclick="toggleCode('M000027-source');return false;">[Source]</a></p>
1950
+ <div class="method-source-code" id="M000027-source">
1919
1951
  <pre>
1920
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 655</span>
1921
- 655: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">port</span>
1922
- 656: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@port</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
1923
- 657: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">scheme</span>.<span class="ruby-identifier">nil?</span>
1924
- 658: <span class="ruby-ivar">@port</span> = <span class="ruby-keyword kw">nil</span>
1925
- 659: <span class="ruby-keyword kw">else</span>
1926
- 660: <span class="ruby-ivar">@port</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">scheme_mapping</span>[<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">scheme</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">downcase</span>]
1927
- 661: <span class="ruby-keyword kw">end</span>
1928
- 662: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@port</span>
1929
- 663: <span class="ruby-keyword kw">else</span>
1930
- 664: <span class="ruby-ivar">@port</span> = <span class="ruby-ivar">@port</span>.<span class="ruby-identifier">to_i</span>
1931
- 665: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@port</span>
1932
- 666: <span class="ruby-keyword kw">end</span>
1933
- 667: <span class="ruby-keyword kw">end</span>
1952
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 673</span>
1953
+ 673: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">port</span>
1954
+ 674: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@port</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
1955
+ 675: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">scheme</span>
1956
+ 676: <span class="ruby-ivar">@port</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">scheme_mapping</span>[<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">scheme</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">downcase</span>]
1957
+ 677: <span class="ruby-keyword kw">else</span>
1958
+ 678: <span class="ruby-ivar">@port</span> = <span class="ruby-keyword kw">nil</span>
1959
+ 679: <span class="ruby-keyword kw">end</span>
1960
+ 680: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@port</span>
1961
+ 681: <span class="ruby-keyword kw">else</span>
1962
+ 682: <span class="ruby-ivar">@port</span> = <span class="ruby-ivar">@port</span>.<span class="ruby-identifier">to_i</span>
1963
+ 683: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@port</span>
1964
+ 684: <span class="ruby-keyword kw">end</span>
1965
+ 685: <span class="ruby-keyword kw">end</span>
1934
1966
  </pre>
1935
1967
  </div>
1936
1968
  </div>
1937
1969
  </div>
1938
1970
 
1939
- <div id="method-M000027" class="method-detail">
1940
- <a name="M000027"></a>
1971
+ <div id="method-M000028" class="method-detail">
1972
+ <a name="M000028"></a>
1941
1973
 
1942
1974
  <div class="method-heading">
1943
- <a href="#M000027" class="method-signature">
1975
+ <a href="#M000028" class="method-signature">
1944
1976
  <span class="method-name">port=</span><span class="method-args">(new_port)</span>
1945
1977
  </a>
1946
1978
  </div>
1947
1979
 
1948
1980
  <div class="method-description">
1949
1981
  <p>
1950
- Sets the <a href="URI.html#M000026">port</a> for this <a
1982
+ Sets the <a href="URI.html#M000027">port</a> for this <a
1951
1983
  href="URI.html">URI</a>.
1952
1984
  </p>
1953
1985
  <p><a class="source-toggle" href="#"
1954
- onclick="toggleCode('M000027-source');return false;">[Source]</a></p>
1955
- <div class="method-source-code" id="M000027-source">
1986
+ onclick="toggleCode('M000028-source');return false;">[Source]</a></p>
1987
+ <div class="method-source-code" id="M000028-source">
1956
1988
  <pre>
1957
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 670</span>
1958
- 670: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">port=</span>(<span class="ruby-identifier">new_port</span>)
1959
- 671: <span class="ruby-ivar">@port</span> = <span class="ruby-identifier">new_port</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">to_i</span>
1960
- 672: <span class="ruby-ivar">@specified_port</span> = <span class="ruby-ivar">@port</span>
1961
- 673: <span class="ruby-ivar">@authority</span> = <span class="ruby-keyword kw">nil</span>
1962
- 674: <span class="ruby-keyword kw">end</span>
1989
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 688</span>
1990
+ 688: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">port=</span>(<span class="ruby-identifier">new_port</span>)
1991
+ 689: <span class="ruby-ivar">@port</span> = <span class="ruby-identifier">new_port</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">to_i</span>
1992
+ 690: <span class="ruby-ivar">@specified_port</span> = <span class="ruby-ivar">@port</span>
1993
+ 691: <span class="ruby-ivar">@authority</span> = <span class="ruby-keyword kw">nil</span>
1994
+ 692: <span class="ruby-keyword kw">end</span>
1963
1995
  </pre>
1964
1996
  </div>
1965
1997
  </div>
1966
1998
  </div>
1967
1999
 
1968
- <div id="method-M000033" class="method-detail">
1969
- <a name="M000033"></a>
2000
+ <div id="method-M000034" class="method-detail">
2001
+ <a name="M000034"></a>
1970
2002
 
1971
2003
  <div class="method-heading">
1972
- <a href="#M000033" class="method-signature">
2004
+ <a href="#M000034" class="method-signature">
1973
2005
  <span class="method-name">query</span><span class="method-args">()</span>
1974
2006
  </a>
1975
2007
  </div>
1976
2008
 
1977
2009
  <div class="method-description">
1978
2010
  <p>
1979
- Returns the <a href="URI.html#M000033">query</a> string for this <a
2011
+ Returns the <a href="URI.html#M000034">query</a> string for this <a
1980
2012
  href="URI.html">URI</a>.
1981
2013
  </p>
1982
2014
  <p><a class="source-toggle" href="#"
1983
- onclick="toggleCode('M000033-source');return false;">[Source]</a></p>
1984
- <div class="method-source-code" id="M000033-source">
2015
+ onclick="toggleCode('M000034-source');return false;">[Source]</a></p>
2016
+ <div class="method-source-code" id="M000034-source">
1985
2017
  <pre>
1986
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 712</span>
1987
- 712: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">query</span>
1988
- 713: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@query</span>
1989
- 714: <span class="ruby-keyword kw">end</span>
2018
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 730</span>
2019
+ 730: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">query</span>
2020
+ 731: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@query</span>
2021
+ 732: <span class="ruby-keyword kw">end</span>
1990
2022
  </pre>
1991
2023
  </div>
1992
2024
  </div>
1993
2025
  </div>
1994
2026
 
1995
- <div id="method-M000034" class="method-detail">
1996
- <a name="M000034"></a>
2027
+ <div id="method-M000035" class="method-detail">
2028
+ <a name="M000035"></a>
1997
2029
 
1998
2030
  <div class="method-heading">
1999
- <a href="#M000034" class="method-signature">
2031
+ <a href="#M000035" class="method-signature">
2000
2032
  <span class="method-name">query=</span><span class="method-args">(new_query)</span>
2001
2033
  </a>
2002
2034
  </div>
2003
2035
 
2004
2036
  <div class="method-description">
2005
2037
  <p>
2006
- Sets the <a href="URI.html#M000033">query</a> string for this <a
2038
+ Sets the <a href="URI.html#M000034">query</a> string for this <a
2007
2039
  href="URI.html">URI</a>.
2008
2040
  </p>
2009
2041
  <p><a class="source-toggle" href="#"
2010
- onclick="toggleCode('M000034-source');return false;">[Source]</a></p>
2011
- <div class="method-source-code" id="M000034-source">
2042
+ onclick="toggleCode('M000035-source');return false;">[Source]</a></p>
2043
+ <div class="method-source-code" id="M000035-source">
2012
2044
  <pre>
2013
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 717</span>
2014
- 717: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">query=</span>(<span class="ruby-identifier">new_query</span>)
2015
- 718: <span class="ruby-ivar">@query</span> = <span class="ruby-identifier">new_query</span>
2016
- 719: <span class="ruby-keyword kw">end</span>
2045
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 735</span>
2046
+ 735: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">query=</span>(<span class="ruby-identifier">new_query</span>)
2047
+ 736: <span class="ruby-ivar">@query</span> = <span class="ruby-identifier">new_query</span>
2048
+ 737: <span class="ruby-keyword kw">end</span>
2017
2049
  </pre>
2018
2050
  </div>
2019
2051
  </div>
2020
2052
  </div>
2021
2053
 
2022
- <div id="method-M000038" class="method-detail">
2023
- <a name="M000038"></a>
2054
+ <div id="method-M000039" class="method-detail">
2055
+ <a name="M000039"></a>
2024
2056
 
2025
2057
  <div class="method-heading">
2026
- <a href="#M000038" class="method-signature">
2058
+ <a href="#M000039" class="method-signature">
2027
2059
  <span class="method-name">relative?</span><span class="method-args">()</span>
2028
2060
  </a>
2029
2061
  </div>
@@ -2033,23 +2065,23 @@ href="URI.html">URI</a>.
2033
2065
  Returns true if this <a href="URI.html">URI</a> is known to be relative.
2034
2066
  </p>
2035
2067
  <p><a class="source-toggle" href="#"
2036
- onclick="toggleCode('M000038-source');return false;">[Source]</a></p>
2037
- <div class="method-source-code" id="M000038-source">
2068
+ onclick="toggleCode('M000039-source');return false;">[Source]</a></p>
2069
+ <div class="method-source-code" id="M000039-source">
2038
2070
  <pre>
2039
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 738</span>
2040
- 738: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">relative?</span>
2041
- 739: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">scheme</span>.<span class="ruby-identifier">nil?</span>
2042
- 740: <span class="ruby-keyword kw">end</span>
2071
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 759</span>
2072
+ 759: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">relative?</span>
2073
+ 760: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">scheme</span>.<span class="ruby-identifier">nil?</span>
2074
+ 761: <span class="ruby-keyword kw">end</span>
2043
2075
  </pre>
2044
2076
  </div>
2045
2077
  </div>
2046
2078
  </div>
2047
2079
 
2048
- <div id="method-M000045" class="method-detail">
2049
- <a name="M000045"></a>
2080
+ <div id="method-M000046" class="method-detail">
2081
+ <a name="M000046"></a>
2050
2082
 
2051
2083
  <div class="method-heading">
2052
- <a href="#M000045" class="method-signature">
2084
+ <a href="#M000046" class="method-signature">
2053
2085
  <span class="method-name">route_from</span><span class="method-args">(uri)</span>
2054
2086
  </a>
2055
2087
  </div>
@@ -2062,64 +2094,68 @@ as a base for resolution. Returns an absolute <a href="URI.html">URI</a> if
2062
2094
  necessary.
2063
2095
  </p>
2064
2096
  <p><a class="source-toggle" href="#"
2065
- onclick="toggleCode('M000045-source');return false;">[Source]</a></p>
2066
- <div class="method-source-code" id="M000045-source">
2097
+ onclick="toggleCode('M000046-source');return false;">[Source]</a></p>
2098
+ <div class="method-source-code" id="M000046-source">
2067
2099
  <pre>
2068
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 853</span>
2069
- 853: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">route_from</span>(<span class="ruby-identifier">uri</span>)
2070
- 854: <span class="ruby-identifier">uri</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">uri</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">to_s</span>)
2071
- 855: <span class="ruby-identifier">uri</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">normalize</span>
2072
- 856: <span class="ruby-identifier">normalized_self</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">normalize</span>
2073
- 857: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">normalized_self</span>.<span class="ruby-identifier">relative?</span>
2074
- 858: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">&quot;Expected absolute URI, got: #{self.to_s}&quot;</span>
2075
- 859: <span class="ruby-keyword kw">end</span>
2076
- 860: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">relative?</span>
2077
- 861: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">&quot;Expected absolute URI, got: #{self.to_s}&quot;</span>
2078
- 862: <span class="ruby-keyword kw">end</span>
2079
- 863: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">normalized_self</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">uri</span>
2080
- 864: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-node">&quot;##{normalized_self.fragment}&quot;</span>)
2081
- 865: <span class="ruby-keyword kw">end</span>
2082
- 866: <span class="ruby-identifier">segments</span> = <span class="ruby-identifier">normalized_self</span>.<span class="ruby-identifier">to_h</span>
2083
- 867: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">normalized_self</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">scheme</span>
2084
- 868: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:scheme</span>] = <span class="ruby-keyword kw">nil</span>
2085
- 869: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">normalized_self</span>.<span class="ruby-identifier">authority</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">authority</span>
2086
- 870: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:user</span>] = <span class="ruby-keyword kw">nil</span>
2087
- 871: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:password</span>] = <span class="ruby-keyword kw">nil</span>
2088
- 872: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:host</span>] = <span class="ruby-keyword kw">nil</span>
2089
- 873: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:port</span>] = <span class="ruby-keyword kw">nil</span>
2090
- 874: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">normalized_self</span>.<span class="ruby-identifier">path</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">path</span>
2091
- 875: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:path</span>] = <span class="ruby-keyword kw">nil</span>
2092
- 876: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">normalized_self</span>.<span class="ruby-identifier">query</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">query</span>
2093
- 877: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:query</span>] = <span class="ruby-keyword kw">nil</span>
2094
- 878: <span class="ruby-keyword kw">end</span>
2095
- 879: <span class="ruby-keyword kw">end</span>
2096
- 880: <span class="ruby-keyword kw">end</span>
2097
- 881: <span class="ruby-keyword kw">end</span>
2098
- 882: <span class="ruby-comment cmt"># Avoid network-path references.</span>
2099
- 883: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:scheme</span>] <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:host</span>] <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
2100
- 884: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:scheme</span>] = <span class="ruby-identifier">normalized_self</span>.<span class="ruby-identifier">scheme</span>
2100
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 874</span>
2101
+ 874: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">route_from</span>(<span class="ruby-identifier">uri</span>)
2102
+ 875: <span class="ruby-identifier">uri</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">uri</span>).<span class="ruby-identifier">normalize</span>
2103
+ 876: <span class="ruby-identifier">normalized_self</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">normalize</span>
2104
+ 877: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">normalized_self</span>.<span class="ruby-identifier">relative?</span>
2105
+ 878: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">&quot;Expected absolute URI, got: #{self.to_s}&quot;</span>
2106
+ 879: <span class="ruby-keyword kw">end</span>
2107
+ 880: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">relative?</span>
2108
+ 881: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">&quot;Expected absolute URI, got: #{uri.to_s}&quot;</span>
2109
+ 882: <span class="ruby-keyword kw">end</span>
2110
+ 883: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">normalized_self</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">uri</span>
2111
+ 884: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-node">&quot;##{normalized_self.fragment}&quot;</span>)
2101
2112
  885: <span class="ruby-keyword kw">end</span>
2102
- 886: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span>.<span class="ruby-identifier">new</span>(
2103
- 887: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:scheme</span>],
2104
- 888: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:user</span>],
2105
- 889: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:password</span>],
2106
- 890: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:host</span>],
2107
- 891: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:port</span>],
2108
- 892: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:path</span>],
2109
- 893: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:query</span>],
2110
- 894: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:fragment</span>]
2111
- 895: )
2112
- 896: <span class="ruby-keyword kw">end</span>
2113
+ 886: <span class="ruby-identifier">segments</span> = <span class="ruby-identifier">normalized_self</span>.<span class="ruby-identifier">to_hash</span>
2114
+ 887: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">normalized_self</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">scheme</span>
2115
+ 888: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:scheme</span>] = <span class="ruby-keyword kw">nil</span>
2116
+ 889: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">normalized_self</span>.<span class="ruby-identifier">authority</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">authority</span>
2117
+ 890: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:user</span>] = <span class="ruby-keyword kw">nil</span>
2118
+ 891: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:password</span>] = <span class="ruby-keyword kw">nil</span>
2119
+ 892: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:host</span>] = <span class="ruby-keyword kw">nil</span>
2120
+ 893: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:port</span>] = <span class="ruby-keyword kw">nil</span>
2121
+ 894: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">normalized_self</span>.<span class="ruby-identifier">path</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">path</span>
2122
+ 895: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:path</span>] = <span class="ruby-keyword kw">nil</span>
2123
+ 896: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">normalized_self</span>.<span class="ruby-identifier">query</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">query</span>
2124
+ 897: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:query</span>] = <span class="ruby-keyword kw">nil</span>
2125
+ 898: <span class="ruby-keyword kw">end</span>
2126
+ 899: <span class="ruby-keyword kw">else</span>
2127
+ 900: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">path</span> <span class="ruby-operator">!=</span> <span class="ruby-value str">&quot;/&quot;</span>
2128
+ 901: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:path</span>].<span class="ruby-identifier">gsub!</span>(
2129
+ 902: <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">&quot;^&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">escape</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">path</span>)), <span class="ruby-value str">&quot;&quot;</span>)
2130
+ 903: <span class="ruby-keyword kw">end</span>
2131
+ 904: <span class="ruby-keyword kw">end</span>
2132
+ 905: <span class="ruby-keyword kw">end</span>
2133
+ 906: <span class="ruby-keyword kw">end</span>
2134
+ 907: <span class="ruby-comment cmt"># Avoid network-path references.</span>
2135
+ 908: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:host</span>] <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
2136
+ 909: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:scheme</span>] = <span class="ruby-identifier">normalized_self</span>.<span class="ruby-identifier">scheme</span>
2137
+ 910: <span class="ruby-keyword kw">end</span>
2138
+ 911: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span>.<span class="ruby-identifier">new</span>(
2139
+ 912: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:scheme</span>],
2140
+ 913: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:user</span>],
2141
+ 914: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:password</span>],
2142
+ 915: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:host</span>],
2143
+ 916: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:port</span>],
2144
+ 917: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:path</span>],
2145
+ 918: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:query</span>],
2146
+ 919: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:fragment</span>]
2147
+ 920: )
2148
+ 921: <span class="ruby-keyword kw">end</span>
2113
2149
  </pre>
2114
2150
  </div>
2115
2151
  </div>
2116
2152
  </div>
2117
2153
 
2118
- <div id="method-M000046" class="method-detail">
2119
- <a name="M000046"></a>
2154
+ <div id="method-M000047" class="method-detail">
2155
+ <a name="M000047"></a>
2120
2156
 
2121
2157
  <div class="method-heading">
2122
- <a href="#M000046" class="method-signature">
2158
+ <a href="#M000047" class="method-signature">
2123
2159
  <span class="method-name">route_to</span><span class="method-args">(uri)</span>
2124
2160
  </a>
2125
2161
  </div>
@@ -2132,111 +2168,110 @@ for resolution. Returns an absolute <a href="URI.html">URI</a> if
2132
2168
  necessary.
2133
2169
  </p>
2134
2170
  <p><a class="source-toggle" href="#"
2135
- onclick="toggleCode('M000046-source');return false;">[Source]</a></p>
2136
- <div class="method-source-code" id="M000046-source">
2171
+ onclick="toggleCode('M000047-source');return false;">[Source]</a></p>
2172
+ <div class="method-source-code" id="M000047-source">
2137
2173
  <pre>
2138
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 901</span>
2139
- 901: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">route_to</span>(<span class="ruby-identifier">uri</span>)
2140
- 902: <span class="ruby-identifier">uri</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">uri</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">to_s</span>)
2141
- 903: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">route_from</span>(<span class="ruby-keyword kw">self</span>)
2142
- 904: <span class="ruby-keyword kw">end</span>
2174
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 926</span>
2175
+ 926: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">route_to</span>(<span class="ruby-identifier">uri</span>)
2176
+ 927: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">uri</span>).<span class="ruby-identifier">route_from</span>(<span class="ruby-keyword kw">self</span>)
2177
+ 928: <span class="ruby-keyword kw">end</span>
2143
2178
  </pre>
2144
2179
  </div>
2145
2180
  </div>
2146
2181
  </div>
2147
2182
 
2148
- <div id="method-M000012" class="method-detail">
2149
- <a name="M000012"></a>
2183
+ <div id="method-M000013" class="method-detail">
2184
+ <a name="M000013"></a>
2150
2185
 
2151
2186
  <div class="method-heading">
2152
- <a href="#M000012" class="method-signature">
2187
+ <a href="#M000013" class="method-signature">
2153
2188
  <span class="method-name">scheme</span><span class="method-args">()</span>
2154
2189
  </a>
2155
2190
  </div>
2156
2191
 
2157
2192
  <div class="method-description">
2158
2193
  <p>
2159
- Returns the <a href="URI.html#M000012">scheme</a> (protocol) for this <a
2194
+ Returns the <a href="URI.html#M000013">scheme</a> (protocol) for this <a
2160
2195
  href="URI.html">URI</a>.
2161
2196
  </p>
2162
2197
  <p><a class="source-toggle" href="#"
2163
- onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
2164
- <div class="method-source-code" id="M000012-source">
2198
+ onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
2199
+ <div class="method-source-code" id="M000013-source">
2165
2200
  <pre>
2166
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 477</span>
2167
- 477: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">scheme</span>
2168
- 478: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@scheme</span>
2169
- 479: <span class="ruby-keyword kw">end</span>
2201
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 496</span>
2202
+ 496: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">scheme</span>
2203
+ 497: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@scheme</span>
2204
+ 498: <span class="ruby-keyword kw">end</span>
2170
2205
  </pre>
2171
2206
  </div>
2172
2207
  </div>
2173
2208
  </div>
2174
2209
 
2175
- <div id="method-M000013" class="method-detail">
2176
- <a name="M000013"></a>
2210
+ <div id="method-M000014" class="method-detail">
2211
+ <a name="M000014"></a>
2177
2212
 
2178
2213
  <div class="method-heading">
2179
- <a href="#M000013" class="method-signature">
2214
+ <a href="#M000014" class="method-signature">
2180
2215
  <span class="method-name">scheme=</span><span class="method-args">(new_scheme)</span>
2181
2216
  </a>
2182
2217
  </div>
2183
2218
 
2184
2219
  <div class="method-description">
2185
2220
  <p>
2186
- Sets the <a href="URI.html#M000012">scheme</a> (protocol for this <a
2221
+ Sets the <a href="URI.html#M000013">scheme</a> (protocol for this <a
2187
2222
  href="URI.html">URI</a>.)
2188
2223
  </p>
2189
2224
  <p><a class="source-toggle" href="#"
2190
- onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
2191
- <div class="method-source-code" id="M000013-source">
2225
+ onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
2226
+ <div class="method-source-code" id="M000014-source">
2192
2227
  <pre>
2193
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 482</span>
2194
- 482: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">scheme=</span>(<span class="ruby-identifier">new_scheme</span>)
2195
- 483: <span class="ruby-ivar">@scheme</span> = <span class="ruby-identifier">new_scheme</span>
2196
- 484: <span class="ruby-keyword kw">end</span>
2228
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 501</span>
2229
+ 501: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">scheme=</span>(<span class="ruby-identifier">new_scheme</span>)
2230
+ 502: <span class="ruby-ivar">@scheme</span> = <span class="ruby-identifier">new_scheme</span>
2231
+ 503: <span class="ruby-keyword kw">end</span>
2197
2232
  </pre>
2198
2233
  </div>
2199
2234
  </div>
2200
2235
  </div>
2201
2236
 
2202
- <div id="method-M000028" class="method-detail">
2203
- <a name="M000028"></a>
2237
+ <div id="method-M000029" class="method-detail">
2238
+ <a name="M000029"></a>
2204
2239
 
2205
2240
  <div class="method-heading">
2206
- <a href="#M000028" class="method-signature">
2241
+ <a href="#M000029" class="method-signature">
2207
2242
  <span class="method-name">specified_port</span><span class="method-args">()</span>
2208
2243
  </a>
2209
2244
  </div>
2210
2245
 
2211
2246
  <div class="method-description">
2212
2247
  <p>
2213
- Returns the <a href="URI.html#M000026">port</a> number that was actually
2248
+ Returns the <a href="URI.html#M000027">port</a> number that was actually
2214
2249
  specified in the <a href="URI.html">URI</a> string.
2215
2250
  </p>
2216
2251
  <p><a class="source-toggle" href="#"
2217
- onclick="toggleCode('M000028-source');return false;">[Source]</a></p>
2218
- <div class="method-source-code" id="M000028-source">
2252
+ onclick="toggleCode('M000029-source');return false;">[Source]</a></p>
2253
+ <div class="method-source-code" id="M000029-source">
2219
2254
  <pre>
2220
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 677</span>
2221
- 677: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">specified_port</span>
2222
- 678: <span class="ruby-identifier">port</span> = <span class="ruby-ivar">@specified_port</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">to_i</span>
2223
- 679: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">port</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
2224
- 680: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
2225
- 681: <span class="ruby-keyword kw">else</span>
2226
- 682: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">port</span>
2227
- 683: <span class="ruby-keyword kw">end</span>
2228
- 684: <span class="ruby-keyword kw">end</span>
2255
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 695</span>
2256
+ 695: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">specified_port</span>
2257
+ 696: <span class="ruby-identifier">port</span> = <span class="ruby-ivar">@specified_port</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">to_i</span>
2258
+ 697: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">port</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
2259
+ 698: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
2260
+ 699: <span class="ruby-keyword kw">else</span>
2261
+ 700: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">port</span>
2262
+ 701: <span class="ruby-keyword kw">end</span>
2263
+ 702: <span class="ruby-keyword kw">end</span>
2229
2264
  </pre>
2230
2265
  </div>
2231
2266
  </div>
2232
2267
  </div>
2233
2268
 
2234
- <div id="method-M000055" class="method-detail">
2235
- <a name="M000055"></a>
2269
+ <div id="method-M000056" class="method-detail">
2270
+ <a name="M000056"></a>
2236
2271
 
2237
2272
  <div class="method-heading">
2238
- <a href="#M000055" class="method-signature">
2239
- <span class="method-name">to_h</span><span class="method-args">()</span>
2273
+ <a href="#M000056" class="method-signature">
2274
+ <span class="method-name">to_hash</span><span class="method-args">()</span>
2240
2275
  </a>
2241
2276
  </div>
2242
2277
 
@@ -2245,32 +2280,32 @@ specified in the <a href="URI.html">URI</a> string.
2245
2280
  Returns a Hash of the <a href="URI.html">URI</a> segments.
2246
2281
  </p>
2247
2282
  <p><a class="source-toggle" href="#"
2248
- onclick="toggleCode('M000055-source');return false;">[Source]</a></p>
2249
- <div class="method-source-code" id="M000055-source">
2283
+ onclick="toggleCode('M000056-source');return false;">[Source]</a></p>
2284
+ <div class="method-source-code" id="M000056-source">
2250
2285
  <pre>
2251
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 1079</span>
2252
- 1079: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_h</span>
2253
- 1080: <span class="ruby-keyword kw">return</span> {
2254
- 1081: <span class="ruby-identifier">:scheme</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">scheme</span>,
2255
- 1082: <span class="ruby-identifier">:user</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">user</span>,
2256
- 1083: <span class="ruby-identifier">:password</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">password</span>,
2257
- 1084: <span class="ruby-identifier">:host</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">host</span>,
2258
- 1085: <span class="ruby-identifier">:port</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">specified_port</span>,
2259
- 1086: <span class="ruby-identifier">:path</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">path</span>,
2260
- 1087: <span class="ruby-identifier">:query</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">query</span>,
2261
- 1088: <span class="ruby-identifier">:fragment</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fragment</span>
2262
- 1089: }
2263
- 1090: <span class="ruby-keyword kw">end</span>
2286
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 1090</span>
2287
+ 1090: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_hash</span>
2288
+ 1091: <span class="ruby-keyword kw">return</span> {
2289
+ 1092: <span class="ruby-identifier">:scheme</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">scheme</span>,
2290
+ 1093: <span class="ruby-identifier">:user</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">user</span>,
2291
+ 1094: <span class="ruby-identifier">:password</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">password</span>,
2292
+ 1095: <span class="ruby-identifier">:host</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">host</span>,
2293
+ 1096: <span class="ruby-identifier">:port</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">specified_port</span>,
2294
+ 1097: <span class="ruby-identifier">:path</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">path</span>,
2295
+ 1098: <span class="ruby-identifier">:query</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">query</span>,
2296
+ 1099: <span class="ruby-identifier">:fragment</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fragment</span>
2297
+ 1100: }
2298
+ 1101: <span class="ruby-keyword kw">end</span>
2264
2299
  </pre>
2265
2300
  </div>
2266
2301
  </div>
2267
2302
  </div>
2268
2303
 
2269
- <div id="method-M000054" class="method-detail">
2270
- <a name="M000054"></a>
2304
+ <div id="method-M000055" class="method-detail">
2305
+ <a name="M000055"></a>
2271
2306
 
2272
2307
  <div class="method-heading">
2273
- <a href="#M000054" class="method-signature">
2308
+ <a href="#M000055" class="method-signature">
2274
2309
  <span class="method-name">to_s</span><span class="method-args">()</span>
2275
2310
  </a>
2276
2311
  </div>
@@ -2280,161 +2315,161 @@ Returns a Hash of the <a href="URI.html">URI</a> segments.
2280
2315
  Returns the assembled <a href="URI.html">URI</a> as a string.
2281
2316
  </p>
2282
2317
  <p><a class="source-toggle" href="#"
2283
- onclick="toggleCode('M000054-source');return false;">[Source]</a></p>
2284
- <div class="method-source-code" id="M000054-source">
2318
+ onclick="toggleCode('M000055-source');return false;">[Source]</a></p>
2319
+ <div class="method-source-code" id="M000055-source">
2285
2320
  <pre>
2286
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 1068</span>
2287
- 1068: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
2288
- 1069: <span class="ruby-identifier">uri_string</span> = <span class="ruby-value str">&quot;&quot;</span>
2289
- 1070: <span class="ruby-identifier">uri_string</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;#{self.scheme}:&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
2290
- 1071: <span class="ruby-identifier">uri_string</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;//#{self.authority}&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">authority</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
2291
- 1072: <span class="ruby-identifier">uri_string</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">path</span>.<span class="ruby-identifier">to_s</span>
2292
- 1073: <span class="ruby-identifier">uri_string</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;?#{self.query}&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">query</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
2293
- 1074: <span class="ruby-identifier">uri_string</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;##{self.fragment}&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fragment</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
2294
- 1075: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">uri_string</span>
2295
- 1076: <span class="ruby-keyword kw">end</span>
2321
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 1079</span>
2322
+ 1079: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
2323
+ 1080: <span class="ruby-identifier">uri_string</span> = <span class="ruby-value str">&quot;&quot;</span>
2324
+ 1081: <span class="ruby-identifier">uri_string</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;#{self.scheme}:&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
2325
+ 1082: <span class="ruby-identifier">uri_string</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;//#{self.authority}&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">authority</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
2326
+ 1083: <span class="ruby-identifier">uri_string</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">path</span>.<span class="ruby-identifier">to_s</span>
2327
+ 1084: <span class="ruby-identifier">uri_string</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;?#{self.query}&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">query</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
2328
+ 1085: <span class="ruby-identifier">uri_string</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;##{self.fragment}&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fragment</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
2329
+ 1086: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">uri_string</span>
2330
+ 1087: <span class="ruby-keyword kw">end</span>
2296
2331
  </pre>
2297
2332
  </div>
2298
2333
  </div>
2299
2334
  </div>
2300
2335
 
2301
- <div id="method-M000014" class="method-detail">
2302
- <a name="M000014"></a>
2336
+ <div id="method-M000015" class="method-detail">
2337
+ <a name="M000015"></a>
2303
2338
 
2304
2339
  <div class="method-heading">
2305
- <a href="#M000014" class="method-signature">
2340
+ <a href="#M000015" class="method-signature">
2306
2341
  <span class="method-name">user</span><span class="method-args">()</span>
2307
2342
  </a>
2308
2343
  </div>
2309
2344
 
2310
2345
  <div class="method-description">
2311
2346
  <p>
2312
- Returns the <a href="URI.html#M000014">user</a> for this <a
2347
+ Returns the <a href="URI.html#M000015">user</a> for this <a
2313
2348
  href="URI.html">URI</a>.
2314
2349
  </p>
2315
2350
  <p><a class="source-toggle" href="#"
2316
- onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
2317
- <div class="method-source-code" id="M000014-source">
2351
+ onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
2352
+ <div class="method-source-code" id="M000015-source">
2318
2353
  <pre>
2319
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 487</span>
2320
- 487: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">user</span>
2321
- 488: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@user</span>
2322
- 489: <span class="ruby-keyword kw">end</span>
2354
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 506</span>
2355
+ 506: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">user</span>
2356
+ 507: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@user</span>
2357
+ 508: <span class="ruby-keyword kw">end</span>
2323
2358
  </pre>
2324
2359
  </div>
2325
2360
  </div>
2326
2361
  </div>
2327
2362
 
2328
- <div id="method-M000015" class="method-detail">
2329
- <a name="M000015"></a>
2363
+ <div id="method-M000016" class="method-detail">
2364
+ <a name="M000016"></a>
2330
2365
 
2331
2366
  <div class="method-heading">
2332
- <a href="#M000015" class="method-signature">
2367
+ <a href="#M000016" class="method-signature">
2333
2368
  <span class="method-name">user=</span><span class="method-args">(new_user)</span>
2334
2369
  </a>
2335
2370
  </div>
2336
2371
 
2337
2372
  <div class="method-description">
2338
2373
  <p>
2339
- Sets the <a href="URI.html#M000014">user</a> for this <a
2374
+ Sets the <a href="URI.html#M000015">user</a> for this <a
2340
2375
  href="URI.html">URI</a>.
2341
2376
  </p>
2342
2377
  <p><a class="source-toggle" href="#"
2343
- onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
2344
- <div class="method-source-code" id="M000015-source">
2378
+ onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
2379
+ <div class="method-source-code" id="M000016-source">
2345
2380
  <pre>
2346
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 492</span>
2347
- 492: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">user=</span>(<span class="ruby-identifier">new_user</span>)
2348
- 493: <span class="ruby-ivar">@user</span> = <span class="ruby-identifier">new_user</span>
2349
- 494:
2350
- 495: <span class="ruby-comment cmt"># You can't have a nil user with a non-nil password</span>
2351
- 496: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@password</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
2352
- 497: <span class="ruby-ivar">@user</span> = <span class="ruby-value str">&quot;&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@user</span>.<span class="ruby-identifier">nil?</span>
2353
- 498: <span class="ruby-keyword kw">end</span>
2354
- 499:
2355
- 500: <span class="ruby-comment cmt"># Reset dependant values</span>
2356
- 501: <span class="ruby-ivar">@userinfo</span> = <span class="ruby-keyword kw">nil</span>
2357
- 502: <span class="ruby-ivar">@authority</span> = <span class="ruby-keyword kw">nil</span>
2358
- 503:
2359
- 504: <span class="ruby-comment cmt"># Ensure we haven't created an invalid URI</span>
2360
- 505: <span class="ruby-identifier">validate</span>()
2361
- 506: <span class="ruby-keyword kw">end</span>
2381
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 511</span>
2382
+ 511: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">user=</span>(<span class="ruby-identifier">new_user</span>)
2383
+ 512: <span class="ruby-ivar">@user</span> = <span class="ruby-identifier">new_user</span>
2384
+ 513:
2385
+ 514: <span class="ruby-comment cmt"># You can't have a nil user with a non-nil password</span>
2386
+ 515: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@password</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
2387
+ 516: <span class="ruby-ivar">@user</span> = <span class="ruby-value str">&quot;&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@user</span>.<span class="ruby-identifier">nil?</span>
2388
+ 517: <span class="ruby-keyword kw">end</span>
2389
+ 518:
2390
+ 519: <span class="ruby-comment cmt"># Reset dependant values</span>
2391
+ 520: <span class="ruby-ivar">@userinfo</span> = <span class="ruby-keyword kw">nil</span>
2392
+ 521: <span class="ruby-ivar">@authority</span> = <span class="ruby-keyword kw">nil</span>
2393
+ 522:
2394
+ 523: <span class="ruby-comment cmt"># Ensure we haven't created an invalid URI</span>
2395
+ 524: <span class="ruby-identifier">validate</span>()
2396
+ 525: <span class="ruby-keyword kw">end</span>
2362
2397
  </pre>
2363
2398
  </div>
2364
2399
  </div>
2365
2400
  </div>
2366
2401
 
2367
- <div id="method-M000018" class="method-detail">
2368
- <a name="M000018"></a>
2402
+ <div id="method-M000019" class="method-detail">
2403
+ <a name="M000019"></a>
2369
2404
 
2370
2405
  <div class="method-heading">
2371
- <a href="#M000018" class="method-signature">
2406
+ <a href="#M000019" class="method-signature">
2372
2407
  <span class="method-name">userinfo</span><span class="method-args">()</span>
2373
2408
  </a>
2374
2409
  </div>
2375
2410
 
2376
2411
  <div class="method-description">
2377
2412
  <p>
2378
- Returns the username and <a href="URI.html#M000016">password</a> segment of
2413
+ Returns the username and <a href="URI.html#M000017">password</a> segment of
2379
2414
  this <a href="URI.html">URI</a>.
2380
2415
  </p>
2381
2416
  <p><a class="source-toggle" href="#"
2382
- onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
2383
- <div class="method-source-code" id="M000018-source">
2417
+ onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
2418
+ <div class="method-source-code" id="M000019-source">
2384
2419
  <pre>
2385
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 531</span>
2386
- 531: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">userinfo</span>
2387
- 532: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-keyword kw">defined?</span>(<span class="ruby-ivar">@userinfo</span>) <span class="ruby-operator">||</span> <span class="ruby-ivar">@userinfo</span>.<span class="ruby-identifier">nil?</span>
2388
- 533: <span class="ruby-identifier">current_user</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">user</span>
2389
- 534: <span class="ruby-identifier">current_password</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">password</span>
2390
- 535: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">current_user</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">current_password</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
2391
- 536: <span class="ruby-ivar">@userinfo</span> = <span class="ruby-keyword kw">nil</span>
2392
- 537: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">current_user</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">current_password</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
2393
- 538: <span class="ruby-ivar">@userinfo</span> = <span class="ruby-node">&quot;#{current_user}&quot;</span>
2394
- 539: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">current_user</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">current_password</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
2395
- 540: <span class="ruby-ivar">@userinfo</span> = <span class="ruby-node">&quot;#{current_user}:#{current_password}&quot;</span>
2396
- 541: <span class="ruby-keyword kw">end</span>
2397
- 542: <span class="ruby-keyword kw">end</span>
2398
- 543: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@userinfo</span>
2399
- 544: <span class="ruby-keyword kw">end</span>
2420
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 550</span>
2421
+ 550: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">userinfo</span>
2422
+ 551: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-keyword kw">defined?</span>(<span class="ruby-ivar">@userinfo</span>) <span class="ruby-operator">||</span> <span class="ruby-ivar">@userinfo</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
2423
+ 552: <span class="ruby-identifier">current_user</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">user</span>
2424
+ 553: <span class="ruby-identifier">current_password</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">password</span>
2425
+ 554: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">current_user</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">current_password</span>
2426
+ 555: <span class="ruby-ivar">@userinfo</span> = <span class="ruby-keyword kw">nil</span>
2427
+ 556: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">current_user</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">current_password</span>
2428
+ 557: <span class="ruby-ivar">@userinfo</span> = <span class="ruby-node">&quot;#{current_user}:#{current_password}&quot;</span>
2429
+ 558: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">current_user</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">current_password</span>
2430
+ 559: <span class="ruby-ivar">@userinfo</span> = <span class="ruby-node">&quot;#{current_user}&quot;</span>
2431
+ 560: <span class="ruby-keyword kw">end</span>
2432
+ 561: <span class="ruby-keyword kw">end</span>
2433
+ 562: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@userinfo</span>
2434
+ 563: <span class="ruby-keyword kw">end</span>
2400
2435
  </pre>
2401
2436
  </div>
2402
2437
  </div>
2403
2438
  </div>
2404
2439
 
2405
- <div id="method-M000019" class="method-detail">
2406
- <a name="M000019"></a>
2440
+ <div id="method-M000020" class="method-detail">
2441
+ <a name="M000020"></a>
2407
2442
 
2408
2443
  <div class="method-heading">
2409
- <a href="#M000019" class="method-signature">
2444
+ <a href="#M000020" class="method-signature">
2410
2445
  <span class="method-name">userinfo=</span><span class="method-args">(new_userinfo)</span>
2411
2446
  </a>
2412
2447
  </div>
2413
2448
 
2414
2449
  <div class="method-description">
2415
2450
  <p>
2416
- Sets the username and <a href="URI.html#M000016">password</a> segment of
2451
+ Sets the username and <a href="URI.html#M000017">password</a> segment of
2417
2452
  this <a href="URI.html">URI</a>.
2418
2453
  </p>
2419
2454
  <p><a class="source-toggle" href="#"
2420
- onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
2421
- <div class="method-source-code" id="M000019-source">
2455
+ onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
2456
+ <div class="method-source-code" id="M000020-source">
2422
2457
  <pre>
2423
- <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 547</span>
2424
- 547: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">userinfo=</span>(<span class="ruby-identifier">new_userinfo</span>)
2425
- 548: <span class="ruby-identifier">new_user</span> = <span class="ruby-identifier">new_userinfo</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/^(.*):/</span>).<span class="ruby-identifier">flatten</span>[<span class="ruby-value">0</span>]
2426
- 549: <span class="ruby-identifier">new_password</span> = <span class="ruby-identifier">new_userinfo</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/:(.*)$/</span>).<span class="ruby-identifier">flatten</span>[<span class="ruby-value">0</span>]
2427
- 550:
2428
- 551: <span class="ruby-comment cmt"># Password assigned first to ensure validity in case of nil</span>
2429
- 552: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">password</span> = <span class="ruby-identifier">new_password</span>
2430
- 553: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">user</span> = <span class="ruby-identifier">new_user</span>
2431
- 554:
2432
- 555: <span class="ruby-comment cmt"># Reset dependant values</span>
2433
- 556: <span class="ruby-ivar">@authority</span> = <span class="ruby-keyword kw">nil</span>
2434
- 557:
2435
- 558: <span class="ruby-comment cmt"># Ensure we haven't created an invalid URI</span>
2436
- 559: <span class="ruby-identifier">validate</span>()
2437
- 560: <span class="ruby-keyword kw">end</span>
2458
+ <span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 566</span>
2459
+ 566: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">userinfo=</span>(<span class="ruby-identifier">new_userinfo</span>)
2460
+ 567: <span class="ruby-identifier">new_user</span> = <span class="ruby-identifier">new_userinfo</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/^(.*):/</span>).<span class="ruby-identifier">flatten</span>[<span class="ruby-value">0</span>]
2461
+ 568: <span class="ruby-identifier">new_password</span> = <span class="ruby-identifier">new_userinfo</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/:(.*)$/</span>).<span class="ruby-identifier">flatten</span>[<span class="ruby-value">0</span>]
2462
+ 569:
2463
+ 570: <span class="ruby-comment cmt"># Password assigned first to ensure validity in case of nil</span>
2464
+ 571: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">password</span> = <span class="ruby-identifier">new_password</span>
2465
+ 572: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">user</span> = <span class="ruby-identifier">new_user</span>
2466
+ 573:
2467
+ 574: <span class="ruby-comment cmt"># Reset dependant values</span>
2468
+ 575: <span class="ruby-ivar">@authority</span> = <span class="ruby-keyword kw">nil</span>
2469
+ 576:
2470
+ 577: <span class="ruby-comment cmt"># Ensure we haven't created an invalid URI</span>
2471
+ 578: <span class="ruby-identifier">validate</span>()
2472
+ 579: <span class="ruby-keyword kw">end</span>
2438
2473
  </pre>
2439
2474
  </div>
2440
2475
  </div>