addressable 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +3 -0
- data/coverage/index.html +109 -161
- data/coverage/lib-addressable-uri_rb.html +1280 -1298
- data/coverage/lib-addressable-version_rb.html +90 -111
- data/doc/classes/Addressable/URI.html +718 -715
- data/doc/classes/Addressable/URI/IDNA.html +22 -22
- data/doc/created.rid +1 -1
- data/doc/files/CHANGELOG.html +6 -2
- data/doc/files/lib/addressable/uri_rb.html +1 -1
- data/doc/files/lib/addressable/version_rb.html +1 -1
- data/lib/addressable/uri.rb +4 -1
- data/lib/addressable/version.rb +1 -1
- data/spec/addressable/uri_spec.rb +27 -0
- data/specdoc/index.html +651 -425
- metadata +71 -64
@@ -1,9 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
<style type='text/css'>body { background-color: rgb(240, 240, 245); }</style>
|
6
|
-
<style type='text/css'>span.cross-ref-title {
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
2
|
+
<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'><head><title>lib/addressable/version.rb - C0 code coverage information</title>
|
3
|
+
<style type='text/css'>body { background-color: rgb(240, 240, 245); }</style>
|
4
|
+
<style type='text/css'>span.cross-ref-title {
|
7
5
|
font-size: 140%;
|
8
6
|
}
|
9
7
|
span.cross-ref a {
|
@@ -123,7 +121,7 @@ table.report tr.dark {
|
|
123
121
|
background-color: rgb(230, 230, 235);
|
124
122
|
}
|
125
123
|
</style>
|
126
|
-
|
124
|
+
<script type='text/javascript'>
|
127
125
|
// <![CDATA[
|
128
126
|
function toggleCode( id ) {
|
129
127
|
if ( document.getElementById )
|
@@ -148,7 +146,7 @@ table.report tr.dark {
|
|
148
146
|
document.writeln( "<style type=\"text/css\">span.cross-ref { display: none }</style>" )
|
149
147
|
// ]]>
|
150
148
|
</script>
|
151
|
-
|
149
|
+
<style type='text/css'>span.run0 {
|
152
150
|
background-color: rgb(178, 204, 255);
|
153
151
|
display: block;
|
154
152
|
}
|
@@ -553,111 +551,92 @@ span.run100 {
|
|
553
551
|
display: block;
|
554
552
|
}
|
555
553
|
</style>
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
554
|
+
</head>
|
555
|
+
<body><h3>C0 code coverage information</h3>
|
556
|
+
<p>Generated on Sun Dec 09 23:54:29 -0500 2007 with <a href='http://eigenclass.org/hiki/rcov'>rcov 0.8.1.2</a>
|
557
|
+
</p>
|
558
|
+
<hr/>
|
559
|
+
<pre><span class='marked0'>Code reported as executed by Ruby looks like this...
|
562
560
|
</span><span class='marked1'>and this: this line is also marked as covered.
|
563
561
|
</span><span class='inferred0'>Lines considered as run by rcov, but not reported by Ruby, look like this,
|
564
562
|
</span><span class='inferred1'>and this: these lines were inferred by rcov (using simple heuristics).
|
565
563
|
</span><span class='uncovered0'>Finally, here's a line marked as not executed.
|
566
564
|
</span></pre>
|
567
|
-
|
568
|
-
<
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
</
|
576
|
-
</
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
</span><span class="inferred1"><a name="
|
624
|
-
</span><span class="inferred0"><a name="
|
625
|
-
</span><span class="inferred1"><a name="
|
626
|
-
</span><span class="
|
627
|
-
</span><span class="
|
628
|
-
</span><span class="
|
629
|
-
</span><span class="
|
630
|
-
</span><span class="
|
631
|
-
</span><span class="inferred1"><a name="
|
632
|
-
</span><span class="
|
633
|
-
</span><span class="inferred1"><a name="
|
634
|
-
</span><span class="inferred0"><a name="
|
635
|
-
</span><
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
</
|
640
|
-
|
641
|
-
</
|
642
|
-
</
|
643
|
-
</
|
644
|
-
</
|
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
|
-
</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
|
-
<a href='http://validator.w3.org/check/referer'>
|
656
|
-
<img src='http://www.w3.org/Icons/valid-xhtml10' height='31' alt='Valid XHTML 1.0!' width='88' />
|
657
|
-
</a>
|
658
|
-
<a href='http://jigsaw.w3.org/css-validator/check/referer'>
|
659
|
-
<img src='http://jigsaw.w3.org/css-validator/images/vcss' alt='Valid CSS!' style='border:0;width:88px;height:31px' />
|
660
|
-
</a>
|
661
|
-
</p>
|
662
|
-
</body>
|
663
|
-
</html>
|
565
|
+
<table class='report'><thead><tr><td class='heading'>Name</td>
|
566
|
+
<td class='heading'>Total lines</td>
|
567
|
+
<td class='heading'>Lines of code</td>
|
568
|
+
<td class='heading'>Total coverage</td>
|
569
|
+
<td class='heading'>Code coverage</td>
|
570
|
+
</tr>
|
571
|
+
</thead>
|
572
|
+
<tbody><tr class='light'><td><a href='lib-addressable-version_rb.html'>lib/addressable/version.rb</a>
|
573
|
+
</td>
|
574
|
+
<td class='lines_total'><tt>32</tt>
|
575
|
+
</td>
|
576
|
+
<td class='lines_code'><tt>8</tt>
|
577
|
+
</td>
|
578
|
+
<td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>100.0%</tt>
|
579
|
+
</td>
|
580
|
+
<td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/>
|
581
|
+
<td class='uncovered' width='0'/>
|
582
|
+
</tr>
|
583
|
+
</table>
|
584
|
+
</td>
|
585
|
+
</tr>
|
586
|
+
</table>
|
587
|
+
</td>
|
588
|
+
<td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>100.0%</tt>
|
589
|
+
</td>
|
590
|
+
<td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/>
|
591
|
+
<td class='uncovered' width='0'/>
|
592
|
+
</tr>
|
593
|
+
</table>
|
594
|
+
</td>
|
595
|
+
</tr>
|
596
|
+
</table>
|
597
|
+
</td>
|
598
|
+
</tr>
|
599
|
+
</tbody>
|
600
|
+
</table>
|
601
|
+
<pre><span class="inferred1"><a name="line1"></a> 1 #--
|
602
|
+
</span><span class="inferred0"><a name="line2"></a> 2 # Addressable, Copyright (c) 2006-2007 Bob Aman
|
603
|
+
</span><span class="inferred1"><a name="line3"></a> 3 #
|
604
|
+
</span><span class="inferred0"><a name="line4"></a> 4 # Permission is hereby granted, free of charge, to any person obtaining
|
605
|
+
</span><span class="inferred1"><a name="line5"></a> 5 # a copy of this software and associated documentation files (the
|
606
|
+
</span><span class="inferred0"><a name="line6"></a> 6 # "Software"), to deal in the Software without restriction, including
|
607
|
+
</span><span class="inferred1"><a name="line7"></a> 7 # without limitation the rights to use, copy, modify, merge, publish,
|
608
|
+
</span><span class="inferred0"><a name="line8"></a> 8 # distribute, sublicense, and/or sell copies of the Software, and to
|
609
|
+
</span><span class="inferred1"><a name="line9"></a> 9 # permit persons to whom the Software is furnished to do so, subject to
|
610
|
+
</span><span class="inferred0"><a name="line10"></a>10 # the following conditions:
|
611
|
+
</span><span class="inferred1"><a name="line11"></a>11 #
|
612
|
+
</span><span class="inferred0"><a name="line12"></a>12 # The above copyright notice and this permission notice shall be
|
613
|
+
</span><span class="inferred1"><a name="line13"></a>13 # included in all copies or substantial portions of the Software.
|
614
|
+
</span><span class="inferred0"><a name="line14"></a>14 #
|
615
|
+
</span><span class="inferred1"><a name="line15"></a>15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
616
|
+
</span><span class="inferred0"><a name="line16"></a>16 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
617
|
+
</span><span class="inferred1"><a name="line17"></a>17 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
618
|
+
</span><span class="inferred0"><a name="line18"></a>18 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
619
|
+
</span><span class="inferred1"><a name="line19"></a>19 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
620
|
+
</span><span class="inferred0"><a name="line20"></a>20 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
621
|
+
</span><span class="inferred1"><a name="line21"></a>21 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
622
|
+
</span><span class="inferred0"><a name="line22"></a>22 #++
|
623
|
+
</span><span class="inferred1"><a name="line23"></a>23
|
624
|
+
</span><span class="marked0"><a name="line24"></a>24 module Addressable
|
625
|
+
</span><span class="marked1"><a name="line25"></a>25 module ADDRESSABLE_VERSION #:nodoc:
|
626
|
+
</span><span class="marked0"><a name="line26"></a>26 MAJOR = 1
|
627
|
+
</span><span class="marked1"><a name="line27"></a>27 MINOR = 0
|
628
|
+
</span><span class="marked0"><a name="line28"></a>28 TINY = 0
|
629
|
+
</span><span class="inferred1"><a name="line29"></a>29
|
630
|
+
</span><span class="marked0"><a name="line30"></a>30 STRING = [MAJOR, MINOR, TINY].join('.')
|
631
|
+
</span><span class="inferred1"><a name="line31"></a>31 end
|
632
|
+
</span><span class="inferred0"><a name="line32"></a>32 end
|
633
|
+
</span></pre><hr/>
|
634
|
+
<p>Generated using the <a href='http://eigenclass.org/hiki.rb?rcov'>rcov code coverage analysis tool for Ruby</a>
|
635
|
+
version 0.8.1.2.</p>
|
636
|
+
<p><a href='http://validator.w3.org/check/referer'><img src='http://www.w3.org/Icons/valid-xhtml10' height='31' alt='Valid XHTML 1.0!' width='88'/>
|
637
|
+
</a>
|
638
|
+
<a href='http://jigsaw.w3.org/css-validator/check/referer'><img src='http://jigsaw.w3.org/css-validator/images/vcss' alt='Valid CSS!' style='border:0;width:88px;height:31px'/>
|
639
|
+
</a>
|
640
|
+
</p>
|
641
|
+
</body>
|
642
|
+
</html>
|
@@ -268,28 +268,28 @@ This method does not take IRIs or IDNs into account.
|
|
268
268
|
onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
|
269
269
|
<div class="method-source-code" id="M000009-source">
|
270
270
|
<pre>
|
271
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
271
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 357</span>
|
272
|
+
357: <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
|
+
358: <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
|
+
359: <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
|
+
360: <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
|
+
361: <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
|
+
362: <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
|
+
363: <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
|
+
364: <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
|
+
365: <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
|
+
366: <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
|
+
367: <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
|
+
368: <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
|
+
369: <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
|
+
370: <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
|
+
371: <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
|
+
372: <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
|
+
373: <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
|
+
374: <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
|
+
375: <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
|
+
376: ).<span class="ruby-identifier">to_s</span>
|
292
|
+
377: <span class="ruby-keyword kw">end</span>
|
293
293
|
</pre>
|
294
294
|
</div>
|
295
295
|
</div>
|
@@ -326,17 +326,17 @@ An example:
|
|
326
326
|
onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
|
327
327
|
<div class="method-source-code" id="M000007-source">
|
328
328
|
<pre>
|
329
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
329
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 335</span>
|
330
|
+
335: <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
|
+
336: <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
|
+
337: <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
|
+
338: <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
|
+
339: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">segment</span>.<span class="ruby-identifier">gsub</span>(
|
335
|
+
340: <span class="ruby-node">/[^#{character_class}]/</span>
|
336
|
+
341: ) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">sequence</span><span class="ruby-operator">|</span>
|
337
|
+
342: (<span class="ruby-value str">"%"</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
|
+
343: <span class="ruby-keyword kw">end</span>
|
339
|
+
344: <span class="ruby-keyword kw">end</span>
|
340
340
|
</pre>
|
341
341
|
</div>
|
342
342
|
</div>
|
@@ -440,58 +440,58 @@ Extracts uris from an arbitrary body of text.
|
|
440
440
|
onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
|
441
441
|
<div class="method-source-code" id="M000011-source">
|
442
442
|
<pre>
|
443
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
443
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 423</span>
|
444
|
+
423: <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
|
+
424: <span class="ruby-identifier">defaults</span> = {<span class="ruby-identifier">:base</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">:parse</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">false</span>}
|
446
|
+
425: <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
|
+
426: <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
|
+
427: <span class="ruby-comment cmt"># This regular expression needs to be less forgiving or else it would</span>
|
449
|
+
428: <span class="ruby-comment cmt"># match virtually all text. Which isn't exactly what we're going for.</span>
|
450
|
+
429: <span class="ruby-identifier">extract_regex</span> = <span class="ruby-regexp re">/((([a-z\+]+):)[^ \n\<\>\"\\]+[\w\/])/</span>
|
451
|
+
430: <span class="ruby-identifier">extracted_uris</span> =
|
452
|
+
431: <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
|
+
432: <span class="ruby-identifier">sgml_extract_regex</span> = <span class="ruby-regexp re">/<[^>]+href=\"([^\"]+?)\"[^>]*>/</span>
|
454
|
+
433: <span class="ruby-identifier">sgml_extracted_uris</span> =
|
455
|
+
434: <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
|
+
435: <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
|
+
436: <span class="ruby-identifier">textile_extract_regex</span> = <span class="ruby-regexp re">/\".+?\":([^ ]+\/[^ ]+)[ \,\.\;\:\?\!\<\>\"]/i</span>
|
458
|
+
437: <span class="ruby-identifier">textile_extracted_uris</span> =
|
459
|
+
438: <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
|
+
439: <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
|
+
440: <span class="ruby-identifier">parsed_uris</span> = []
|
462
|
+
441: <span class="ruby-identifier">base_uri</span> = <span class="ruby-keyword kw">nil</span>
|
463
|
+
442: <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
|
+
443: <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
|
+
444: <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
|
+
445: <span class="ruby-keyword kw">end</span>
|
467
|
+
446: <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
|
+
447: <span class="ruby-keyword kw">begin</span>
|
469
|
+
448: <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
|
+
449: <span class="ruby-identifier">parsed_uris</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>)
|
471
|
+
450: <span class="ruby-keyword kw">else</span>
|
472
|
+
451: <span class="ruby-identifier">parsed_uris</span> <span class="ruby-operator"><<</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
|
+
452: <span class="ruby-keyword kw">end</span>
|
474
|
+
453: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span>
|
475
|
+
454: <span class="ruby-keyword kw">nil</span>
|
476
|
+
455: <span class="ruby-keyword kw">end</span>
|
477
|
+
456: <span class="ruby-keyword kw">end</span>
|
478
|
+
457: <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
|
+
458: (<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
|
+
459: <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-operator">==</span> <span class="ruby-value str">"xmlns"</span> <span class="ruby-operator">||</span>
|
481
|
+
460: <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-operator">==</span> <span class="ruby-value str">"xml"</span> <span class="ruby-operator">||</span>
|
482
|
+
461: <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-operator">==</span> <span class="ruby-value str">"thr"</span> <span class="ruby-operator">||</span>
|
483
|
+
462: <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-operator">==</span> <span class="ruby-value str">"this"</span> <span class="ruby-operator">||</span>
|
484
|
+
463: <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-operator">==</span> <span class="ruby-value str">"float"</span> <span class="ruby-operator">||</span>
|
485
|
+
464: <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-operator">==</span> <span class="ruby-value str">"user"</span> <span class="ruby-operator">||</span>
|
486
|
+
465: <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-operator">==</span> <span class="ruby-value str">"username"</span> <span class="ruby-operator">||</span>
|
487
|
+
466: <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-operator">==</span> <span class="ruby-value str">"out"</span>)
|
488
|
+
467: <span class="ruby-keyword kw">end</span>
|
489
|
+
468: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:parse</span>]
|
490
|
+
469: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">parsed_uris</span>
|
491
|
+
470: <span class="ruby-keyword kw">else</span>
|
492
|
+
471: <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
|
+
472: <span class="ruby-keyword kw">end</span>
|
494
|
+
473: <span class="ruby-keyword kw">end</span>
|
495
495
|
</pre>
|
496
496
|
</div>
|
497
497
|
</div>
|
@@ -580,10 +580,10 @@ href="URI.html#M000030">path</a>>
|
|
580
580
|
onclick="toggleCode('M000025-source');return false;">[Source]</a></p>
|
581
581
|
<div class="method-source-code" id="M000025-source">
|
582
582
|
<pre>
|
583
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
584
|
-
|
585
|
-
|
586
|
-
|
583
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 646</span>
|
584
|
+
646: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">ip_based_schemes</span>
|
585
|
+
647: <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
|
+
648: <span class="ruby-keyword kw">end</span>
|
587
587
|
</pre>
|
588
588
|
</div>
|
589
589
|
</div>
|
@@ -606,17 +606,17 @@ Joins several uris together.
|
|
606
606
|
onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
|
607
607
|
<div class="method-source-code" id="M000006-source">
|
608
608
|
<pre>
|
609
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
609
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 312</span>
|
610
|
+
312: <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
|
+
313: <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
|
+
314: <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
|
+
315: <span class="ruby-keyword kw">end</span>
|
614
|
+
316: <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
|
+
317: <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
|
+
318: <span class="ruby-identifier">result</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-identifier">uri</span>)
|
617
|
+
319: <span class="ruby-keyword kw">end</span>
|
618
|
+
320: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">result</span>
|
619
|
+
321: <span class="ruby-keyword kw">end</span>
|
620
620
|
</pre>
|
621
621
|
</div>
|
622
622
|
</div>
|
@@ -640,27 +640,27 @@ parts. Passing nil for any of these parameters is acceptable.
|
|
640
640
|
onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
|
641
641
|
<div class="method-source-code" id="M000012-source">
|
642
642
|
<pre>
|
643
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
643
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 477</span>
|
644
|
+
477: <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
|
+
478: <span class="ruby-ivar">@scheme</span> = <span class="ruby-identifier">scheme</span>
|
646
|
+
479: <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">""</span>
|
647
|
+
480: <span class="ruby-ivar">@user</span> = <span class="ruby-identifier">user</span>
|
648
|
+
481: <span class="ruby-ivar">@password</span> = <span class="ruby-identifier">password</span>
|
649
|
+
482: <span class="ruby-ivar">@host</span> = <span class="ruby-identifier">host</span>
|
650
|
+
483: <span class="ruby-ivar">@specified_port</span> = <span class="ruby-identifier">port</span>.<span class="ruby-identifier">to_s</span>
|
651
|
+
484: <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
|
+
485: <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">&&</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
|
+
486: <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidURIError</span>,
|
654
|
+
487: <span class="ruby-node">"Invalid port number: #{@port.inspect}"</span>
|
655
|
+
488: <span class="ruby-keyword kw">end</span>
|
656
|
+
489: <span class="ruby-ivar">@port</span> = <span class="ruby-ivar">@port</span>.<span class="ruby-identifier">to_i</span>
|
657
|
+
490: <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
|
+
491: <span class="ruby-ivar">@path</span> = (<span class="ruby-identifier">path</span> <span class="ruby-operator">||</span> <span class="ruby-value str">""</span>)
|
659
|
+
492: <span class="ruby-ivar">@query</span> = <span class="ruby-identifier">query</span>
|
660
|
+
493: <span class="ruby-ivar">@fragment</span> = <span class="ruby-identifier">fragment</span>
|
661
|
+
494:
|
662
|
+
495: <span class="ruby-identifier">validate</span>()
|
663
|
+
496: <span class="ruby-keyword kw">end</span>
|
664
664
|
</pre>
|
665
665
|
</div>
|
666
666
|
</div>
|
@@ -685,43 +685,43 @@ names.
|
|
685
685
|
onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
|
686
686
|
<div class="method-source-code" id="M000010-source">
|
687
687
|
<pre>
|
688
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
688
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 385</span>
|
689
|
+
385: <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
|
+
386: <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
|
+
387: <span class="ruby-identifier">segments</span> = {
|
692
|
+
388: <span class="ruby-identifier">:scheme</span> =<span class="ruby-operator">></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
|
+
389: <span class="ruby-identifier">:user</span> =<span class="ruby-operator">></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
|
+
390: <span class="ruby-identifier">:password</span> =<span class="ruby-operator">></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
|
+
391: <span class="ruby-identifier">:host</span> =<span class="ruby-operator">></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
|
+
392: <span class="ruby-identifier">:port</span> =<span class="ruby-operator">></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
|
+
393: <span class="ruby-identifier">:path</span> =<span class="ruby-operator">></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
|
+
394: <span class="ruby-identifier">:query</span> =<span class="ruby-operator">></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
|
+
395: <span class="ruby-identifier">:fragment</span> =<span class="ruby-operator">></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
|
+
396: }
|
701
|
+
397: <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
|
+
398: <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
|
+
399: <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
|
+
400: <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
|
+
401: <span class="ruby-keyword kw">end</span>
|
706
|
+
402: <span class="ruby-keyword kw">end</span>
|
707
|
+
403: <span class="ruby-keyword kw">end</span>
|
708
|
+
404: <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
|
+
405: <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
|
+
406: <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
|
+
407: <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
|
+
408: <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
|
+
409: <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
|
+
410: <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
|
+
411: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:host</span>],
|
716
|
+
412: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:port</span>],
|
717
|
+
413: <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
|
+
414: <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
|
+
415: <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
|
+
416: <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
|
+
417: <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
|
+
418: <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
|
+
419: ).<span class="ruby-identifier">to_s</span>
|
724
|
+
420: <span class="ruby-keyword kw">end</span>
|
725
725
|
</pre>
|
726
726
|
</div>
|
727
727
|
</div>
|
@@ -813,26 +813,26 @@ allow for better <a href="URI.html">URI</a> normalization.
|
|
813
813
|
onclick="toggleCode('M000026-source');return false;">[Source]</a></p>
|
814
814
|
<div class="method-source-code" id="M000026-source">
|
815
815
|
<pre>
|
816
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
816
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 653</span>
|
817
|
+
653: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">scheme_mapping</span>
|
818
|
+
654: <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
|
+
655: <span class="ruby-ivar">@protocol_mapping</span> = {
|
820
|
+
656: <span class="ruby-value str">"http"</span> =<span class="ruby-operator">></span> <span class="ruby-value">80</span>,
|
821
|
+
657: <span class="ruby-value str">"https"</span> =<span class="ruby-operator">></span> <span class="ruby-value">443</span>,
|
822
|
+
658: <span class="ruby-value str">"ftp"</span> =<span class="ruby-operator">></span> <span class="ruby-value">21</span>,
|
823
|
+
659: <span class="ruby-value str">"tftp"</span> =<span class="ruby-operator">></span> <span class="ruby-value">69</span>,
|
824
|
+
660: <span class="ruby-value str">"ssh"</span> =<span class="ruby-operator">></span> <span class="ruby-value">22</span>,
|
825
|
+
661: <span class="ruby-value str">"svn+ssh"</span> =<span class="ruby-operator">></span> <span class="ruby-value">22</span>,
|
826
|
+
662: <span class="ruby-value str">"telnet"</span> =<span class="ruby-operator">></span> <span class="ruby-value">23</span>,
|
827
|
+
663: <span class="ruby-value str">"nntp"</span> =<span class="ruby-operator">></span> <span class="ruby-value">119</span>,
|
828
|
+
664: <span class="ruby-value str">"gopher"</span> =<span class="ruby-operator">></span> <span class="ruby-value">70</span>,
|
829
|
+
665: <span class="ruby-value str">"wais"</span> =<span class="ruby-operator">></span> <span class="ruby-value">210</span>,
|
830
|
+
666: <span class="ruby-value str">"ldap"</span> =<span class="ruby-operator">></span> <span class="ruby-value">389</span>,
|
831
|
+
667: <span class="ruby-value str">"prospero"</span> =<span class="ruby-operator">></span> <span class="ruby-value">1525</span>
|
832
|
+
668: }
|
833
|
+
669: <span class="ruby-keyword kw">end</span>
|
834
|
+
670: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@protocol_mapping</span>
|
835
|
+
671: <span class="ruby-keyword kw">end</span>
|
836
836
|
</pre>
|
837
837
|
</div>
|
838
838
|
</div>
|
@@ -856,13 +856,13 @@ href="URI.html">URI</a> segment. Returns a string.
|
|
856
856
|
onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
|
857
857
|
<div class="method-source-code" id="M000008-source">
|
858
858
|
<pre>
|
859
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
|
859
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 348</span>
|
860
|
+
348: <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
|
+
349: <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
|
+
350: <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
|
+
351: <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
|
+
352: <span class="ruby-keyword kw">end</span>
|
865
|
+
353: <span class="ruby-keyword kw">end</span>
|
866
866
|
</pre>
|
867
867
|
</div>
|
868
868
|
</div>
|
@@ -887,96 +887,96 @@ Joins two URIs together.
|
|
887
887
|
onclick="toggleCode('M000041-source');return false;">[Source]</a></p>
|
888
888
|
<div class="method-source-code" id="M000041-source">
|
889
889
|
<pre>
|
890
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
891
|
-
|
892
|
-
|
893
|
-
|
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">""</span>
|
896
|
-
774: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span>
|
890
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 772</span>
|
891
|
+
772: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">+</span>(<span class="ruby-identifier">uri</span>)
|
892
|
+
773: <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
|
+
774: <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>)
|
897
894
|
775: <span class="ruby-keyword kw">end</span>
|
898
|
-
776:
|
899
|
-
777:
|
900
|
-
778: <span class="ruby-
|
901
|
-
779:
|
902
|
-
780: <span class="ruby-identifier">
|
903
|
-
781: <span class="ruby-identifier">
|
904
|
-
782: <span class="ruby-identifier">
|
905
|
-
783: <span class="ruby-identifier">
|
906
|
-
784: <span class="ruby-identifier">
|
907
|
-
785:
|
908
|
-
786: <span class="ruby-
|
909
|
-
787: <span class="ruby-
|
910
|
-
788:
|
911
|
-
789:
|
912
|
-
790:
|
913
|
-
791: <span class="ruby-identifier">
|
914
|
-
792: <span class="ruby-identifier">
|
915
|
-
793: <span class="ruby-identifier">
|
916
|
-
794: <span class="ruby-identifier">
|
917
|
-
795:
|
918
|
-
796: <span class="ruby-
|
919
|
-
797:
|
920
|
-
798:
|
921
|
-
799:
|
922
|
-
800: <span class="ruby-identifier">
|
923
|
-
801: <span class="ruby-identifier">
|
924
|
-
802: <span class="ruby-identifier">
|
925
|
-
803:
|
926
|
-
804: <span class="ruby-
|
927
|
-
805:
|
928
|
-
806:
|
929
|
-
807:
|
930
|
-
808: <span class="ruby-keyword kw">
|
931
|
-
809:
|
932
|
-
810:
|
933
|
-
811:
|
934
|
-
812:
|
935
|
-
813:
|
936
|
-
814:
|
937
|
-
815:
|
938
|
-
816: <span class="ruby-identifier">
|
939
|
-
817:
|
940
|
-
818:
|
941
|
-
819: <span class="ruby-
|
942
|
-
820: <span class="ruby-
|
943
|
-
821:
|
944
|
-
822: <span class="ruby-
|
945
|
-
823:
|
946
|
-
824: <span class="ruby-
|
947
|
-
825:
|
948
|
-
826:
|
949
|
-
827:
|
950
|
-
828:
|
951
|
-
829: <span class="ruby-
|
952
|
-
830:
|
953
|
-
831:
|
954
|
-
832: <span class="ruby-
|
955
|
-
833:
|
956
|
-
834:
|
957
|
-
835:
|
958
|
-
836:
|
959
|
-
837:
|
960
|
-
838:
|
961
|
-
839:
|
962
|
-
840: <span class="ruby-
|
963
|
-
841: <span class="ruby-identifier">
|
964
|
-
842:
|
965
|
-
843:
|
966
|
-
844:
|
967
|
-
845:
|
968
|
-
846:
|
969
|
-
847: <span class="ruby-keyword kw">
|
970
|
-
848:
|
971
|
-
849:
|
972
|
-
850:
|
973
|
-
851: <span class="ruby-identifier">
|
974
|
-
852: <span class="ruby-identifier">
|
975
|
-
853: <span class="ruby-identifier">
|
976
|
-
854: <span class="ruby-identifier">
|
977
|
-
855: <span class="ruby-identifier">
|
978
|
-
856:
|
979
|
-
857:
|
895
|
+
776: <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">""</span>
|
896
|
+
777: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span>
|
897
|
+
778: <span class="ruby-keyword kw">end</span>
|
898
|
+
779:
|
899
|
+
780: <span class="ruby-identifier">joined_scheme</span> = <span class="ruby-keyword kw">nil</span>
|
900
|
+
781: <span class="ruby-identifier">joined_user</span> = <span class="ruby-keyword kw">nil</span>
|
901
|
+
782: <span class="ruby-identifier">joined_password</span> = <span class="ruby-keyword kw">nil</span>
|
902
|
+
783: <span class="ruby-identifier">joined_host</span> = <span class="ruby-keyword kw">nil</span>
|
903
|
+
784: <span class="ruby-identifier">joined_port</span> = <span class="ruby-keyword kw">nil</span>
|
904
|
+
785: <span class="ruby-identifier">joined_path</span> = <span class="ruby-keyword kw">nil</span>
|
905
|
+
786: <span class="ruby-identifier">joined_query</span> = <span class="ruby-keyword kw">nil</span>
|
906
|
+
787: <span class="ruby-identifier">joined_fragment</span> = <span class="ruby-keyword kw">nil</span>
|
907
|
+
788:
|
908
|
+
789: <span class="ruby-comment cmt"># Section 5.2.2 of RFC 3986</span>
|
909
|
+
790: <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
|
+
791: <span class="ruby-identifier">joined_scheme</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">scheme</span>
|
911
|
+
792: <span class="ruby-identifier">joined_user</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">user</span>
|
912
|
+
793: <span class="ruby-identifier">joined_password</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">password</span>
|
913
|
+
794: <span class="ruby-identifier">joined_host</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">host</span>
|
914
|
+
795: <span class="ruby-identifier">joined_port</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">specified_port</span>
|
915
|
+
796: <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
|
+
797: <span class="ruby-identifier">joined_query</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">query</span>
|
917
|
+
798: <span class="ruby-keyword kw">else</span>
|
918
|
+
799: <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
|
+
800: <span class="ruby-identifier">joined_user</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">user</span>
|
920
|
+
801: <span class="ruby-identifier">joined_password</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">password</span>
|
921
|
+
802: <span class="ruby-identifier">joined_host</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">host</span>
|
922
|
+
803: <span class="ruby-identifier">joined_port</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">specified_port</span>
|
923
|
+
804: <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
|
+
805: <span class="ruby-identifier">joined_query</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">query</span>
|
925
|
+
806: <span class="ruby-keyword kw">else</span>
|
926
|
+
807: <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">""</span>
|
927
|
+
808: <span class="ruby-identifier">joined_path</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">path</span>
|
928
|
+
809: <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
|
+
810: <span class="ruby-identifier">joined_query</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">query</span>
|
930
|
+
811: <span class="ruby-keyword kw">else</span>
|
931
|
+
812: <span class="ruby-identifier">joined_query</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">query</span>
|
932
|
+
813: <span class="ruby-keyword kw">end</span>
|
933
|
+
814: <span class="ruby-keyword kw">else</span>
|
934
|
+
815: <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">"/"</span>
|
935
|
+
816: <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
|
+
817: <span class="ruby-keyword kw">else</span>
|
937
|
+
818: <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
|
+
819: <span class="ruby-identifier">base_path</span> = <span class="ruby-value str">""</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
|
+
820: <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
|
+
821:
|
941
|
+
822: <span class="ruby-comment cmt"># Section 5.2.3 of RFC 3986</span>
|
942
|
+
823: <span class="ruby-comment cmt">#</span>
|
943
|
+
824: <span class="ruby-comment cmt"># Removes the right-most path segment from the base path.</span>
|
944
|
+
825: <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
|
+
826: <span class="ruby-identifier">base_path</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/\/[^\/]+$/</span>, <span class="ruby-value str">"/"</span>)
|
946
|
+
827: <span class="ruby-keyword kw">else</span>
|
947
|
+
828: <span class="ruby-identifier">base_path</span> = <span class="ruby-value str">""</span>
|
948
|
+
829: <span class="ruby-keyword kw">end</span>
|
949
|
+
830:
|
950
|
+
831: <span class="ruby-comment cmt"># If the base path is empty and an authority segment has been</span>
|
951
|
+
832: <span class="ruby-comment cmt"># defined, use a base path of "/"</span>
|
952
|
+
833: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">base_path</span> <span class="ruby-operator">==</span> <span class="ruby-value str">""</span> <span class="ruby-operator">&&</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
|
+
834: <span class="ruby-identifier">base_path</span> = <span class="ruby-value str">"/"</span>
|
954
|
+
835: <span class="ruby-keyword kw">end</span>
|
955
|
+
836:
|
956
|
+
837: <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
|
+
838: <span class="ruby-keyword kw">end</span>
|
958
|
+
839: <span class="ruby-identifier">joined_query</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">query</span>
|
959
|
+
840: <span class="ruby-keyword kw">end</span>
|
960
|
+
841: <span class="ruby-identifier">joined_user</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">user</span>
|
961
|
+
842: <span class="ruby-identifier">joined_password</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">password</span>
|
962
|
+
843: <span class="ruby-identifier">joined_host</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">host</span>
|
963
|
+
844: <span class="ruby-identifier">joined_port</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">specified_port</span>
|
964
|
+
845: <span class="ruby-keyword kw">end</span>
|
965
|
+
846: <span class="ruby-identifier">joined_scheme</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">scheme</span>
|
966
|
+
847: <span class="ruby-keyword kw">end</span>
|
967
|
+
848: <span class="ruby-identifier">joined_fragment</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">fragment</span>
|
968
|
+
849:
|
969
|
+
850: <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
|
+
851: <span class="ruby-identifier">joined_scheme</span>,
|
971
|
+
852: <span class="ruby-identifier">joined_user</span>,
|
972
|
+
853: <span class="ruby-identifier">joined_password</span>,
|
973
|
+
854: <span class="ruby-identifier">joined_host</span>,
|
974
|
+
855: <span class="ruby-identifier">joined_port</span>,
|
975
|
+
856: <span class="ruby-identifier">joined_path</span>,
|
976
|
+
857: <span class="ruby-identifier">joined_query</span>,
|
977
|
+
858: <span class="ruby-identifier">joined_fragment</span>
|
978
|
+
859: )
|
979
|
+
860: <span class="ruby-keyword kw">end</span>
|
980
980
|
</pre>
|
981
981
|
</div>
|
982
982
|
</div>
|
@@ -1000,11 +1000,11 @@ method normalizes both URIs before doing the comparison.
|
|
1000
1000
|
onclick="toggleCode('M000052-source');return false;">[Source]</a></p>
|
1001
1001
|
<div class="method-source-code" id="M000052-source">
|
1002
1002
|
<pre>
|
1003
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1003
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 1046</span>
|
1004
|
+
1046: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">==</span>(<span class="ruby-identifier">uri</span>)
|
1005
|
+
1047: <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
|
+
1048: <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
|
+
1049: <span class="ruby-keyword kw">end</span>
|
1008
1008
|
</pre>
|
1009
1009
|
</div>
|
1010
1010
|
</div>
|
@@ -1029,19 +1029,19 @@ comparison against strings.
|
|
1029
1029
|
onclick="toggleCode('M000051-source');return false;">[Source]</a></p>
|
1030
1030
|
<div class="method-source-code" id="M000051-source">
|
1031
1031
|
<pre>
|
1032
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1032
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 1031</span>
|
1033
|
+
1031: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">===</span>(<span class="ruby-identifier">uri</span>)
|
1034
|
+
1032: <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
|
+
1033: <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
|
+
1034: <span class="ruby-keyword kw">else</span>
|
1037
|
+
1035: <span class="ruby-keyword kw">begin</span>
|
1038
|
+
1036: <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
|
+
1037: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">InvalidURIError</span>
|
1040
|
+
1038: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
|
1041
|
+
1039: <span class="ruby-keyword kw">end</span>
|
1042
|
+
1040: <span class="ruby-keyword kw">end</span>
|
1043
|
+
1041: <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
|
+
1042: <span class="ruby-keyword kw">end</span>
|
1045
1045
|
</pre>
|
1046
1046
|
</div>
|
1047
1047
|
</div>
|
@@ -1064,10 +1064,10 @@ Returns true if this <a href="URI.html">URI</a> is known to be absolute.
|
|
1064
1064
|
onclick="toggleCode('M000040-source');return false;">[Source]</a></p>
|
1065
1065
|
<div class="method-source-code" id="M000040-source">
|
1066
1066
|
<pre>
|
1067
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1067
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 767</span>
|
1068
|
+
767: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">absolute?</span>
|
1069
|
+
768: <span class="ruby-keyword kw">return</span> <span class="ruby-operator">!</span><span class="ruby-identifier">relative?</span>
|
1070
|
+
769: <span class="ruby-keyword kw">end</span>
|
1071
1071
|
</pre>
|
1072
1072
|
</div>
|
1073
1073
|
</div>
|
@@ -1091,21 +1091,21 @@ href="URI.html">URI</a>.
|
|
1091
1091
|
onclick="toggleCode('M000023-source');return false;">[Source]</a></p>
|
1092
1092
|
<div class="method-source-code" id="M000023-source">
|
1093
1093
|
<pre>
|
1094
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1094
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 601</span>
|
1095
|
+
601: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">authority</span>
|
1096
|
+
602: <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
|
+
603: <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
|
+
604: <span class="ruby-ivar">@authority</span> = <span class="ruby-value str">""</span>
|
1099
|
+
605: <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
|
+
606: <span class="ruby-ivar">@authority</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"#{self.userinfo}@"</span>
|
1101
|
+
607: <span class="ruby-keyword kw">end</span>
|
1102
|
+
608: <span class="ruby-ivar">@authority</span> <span class="ruby-operator"><<</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">host</span>
|
1103
|
+
609: <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
|
+
610: <span class="ruby-ivar">@authority</span> <span class="ruby-operator"><<</span> <span class="ruby-node">":#{self.specified_port}"</span>
|
1105
|
+
611: <span class="ruby-keyword kw">end</span>
|
1106
|
+
612: <span class="ruby-keyword kw">end</span>
|
1107
|
+
613: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@authority</span>
|
1108
|
+
614: <span class="ruby-keyword kw">end</span>
|
1109
1109
|
</pre>
|
1110
1110
|
</div>
|
1111
1111
|
</div>
|
@@ -1129,32 +1129,32 @@ href="URI.html">URI</a>.
|
|
1129
1129
|
onclick="toggleCode('M000024-source');return false;">[Source]</a></p>
|
1130
1130
|
<div class="method-source-code" id="M000024-source">
|
1131
1131
|
<pre>
|
1132
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1132
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 617</span>
|
1133
|
+
617: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">authority=</span>(<span class="ruby-identifier">new_authority</span>)
|
1134
|
+
618: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">new_authority</span>
|
1135
|
+
619: <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
|
+
620: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">new_userinfo</span>
|
1137
|
+
621: <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
|
+
622: <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
|
+
623: <span class="ruby-keyword kw">end</span>
|
1140
|
+
624: <span class="ruby-identifier">new_host</span> =
|
1141
|
+
625: <span class="ruby-identifier">new_authority</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/^([^\[\]]*)@/</span>, <span class="ruby-value str">""</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/:([^:@\[\]]*?)$/</span>, <span class="ruby-value str">""</span>)
|
1142
|
+
626: <span class="ruby-identifier">new_port</span> =
|
1143
|
+
627: <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
|
+
628: <span class="ruby-keyword kw">end</span>
|
1145
|
+
629:
|
1146
|
+
630: <span class="ruby-comment cmt"># Password assigned first to ensure validity in case of nil</span>
|
1147
|
+
631: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">password</span> = <span class="ruby-identifier">new_password</span>
|
1148
|
+
632: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">user</span> = <span class="ruby-identifier">new_user</span>
|
1149
|
+
633: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">host</span> = <span class="ruby-identifier">new_host</span>
|
1150
|
+
634:
|
1151
|
+
635: <span class="ruby-comment cmt"># Port reset to allow port normalization</span>
|
1152
|
+
636: <span class="ruby-ivar">@port</span> = <span class="ruby-keyword kw">nil</span>
|
1153
|
+
637: <span class="ruby-ivar">@specified_port</span> = <span class="ruby-identifier">new_port</span>
|
1154
|
+
638:
|
1155
|
+
639: <span class="ruby-comment cmt"># Ensure we haven't created an invalid URI</span>
|
1156
|
+
640: <span class="ruby-identifier">validate</span>()
|
1157
|
+
641: <span class="ruby-keyword kw">end</span>
|
1158
1158
|
</pre>
|
1159
1159
|
</div>
|
1160
1160
|
</div>
|
@@ -1179,11 +1179,11 @@ there is no <a href="URI.html#M000030">path</a> component.
|
|
1179
1179
|
onclick="toggleCode('M000032-source');return false;">[Source]</a></p>
|
1180
1180
|
<div class="method-source-code" id="M000032-source">
|
1181
1181
|
<pre>
|
1182
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
1186
|
-
|
1182
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 719</span>
|
1183
|
+
719: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">basename</span>
|
1184
|
+
720: <span class="ruby-comment cmt"># Path cannot be nil</span>
|
1185
|
+
721: <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">""</span>)
|
1186
|
+
722: <span class="ruby-keyword kw">end</span>
|
1187
1187
|
</pre>
|
1188
1188
|
</div>
|
1189
1189
|
</div>
|
@@ -1209,17 +1209,17 @@ more information.
|
|
1209
1209
|
onclick="toggleCode('M000050-source');return false;">[Source]</a></p>
|
1210
1210
|
<div class="method-source-code" id="M000050-source">
|
1211
1211
|
<pre>
|
1212
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
1213
|
-
|
1214
|
-
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1212
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 1017</span>
|
1213
|
+
1017: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">display_uri</span>
|
1214
|
+
1018: <span class="ruby-identifier">display_uri</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">normalize</span>
|
1215
|
+
1019: <span class="ruby-keyword kw">begin</span>
|
1216
|
+
1020: <span class="ruby-identifier">display_uri</span>.<span class="ruby-identifier">instance_variable_set</span>(<span class="ruby-value str">"@host"</span>,
|
1217
|
+
1021: <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
|
+
1022: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span>
|
1219
|
+
1023: <span class="ruby-keyword kw">nil</span>
|
1220
|
+
1024: <span class="ruby-keyword kw">end</span>
|
1221
|
+
1025: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">display_uri</span>
|
1222
|
+
1026: <span class="ruby-keyword kw">end</span>
|
1223
1223
|
</pre>
|
1224
1224
|
</div>
|
1225
1225
|
</div>
|
@@ -1242,28 +1242,28 @@ Clones the <a href="URI.html">URI</a> object.
|
|
1242
1242
|
onclick="toggleCode('M000054-source');return false;">[Source]</a></p>
|
1243
1243
|
<div class="method-source-code" id="M000054-source">
|
1244
1244
|
<pre>
|
1245
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
1246
|
-
|
1247
|
-
|
1248
|
-
|
1249
|
-
|
1250
|
-
|
1251
|
-
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1255
|
-
|
1256
|
-
|
1257
|
-
|
1258
|
-
|
1259
|
-
|
1260
|
-
|
1261
|
-
|
1262
|
-
|
1263
|
-
|
1264
|
-
|
1265
|
-
|
1266
|
-
|
1245
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 1059</span>
|
1246
|
+
1059: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dup</span>
|
1247
|
+
1060: <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
|
+
1061: <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
|
+
1062: <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
|
+
1063: <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
|
+
1064: <span class="ruby-identifier">duplicated_port</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">specified_port</span>
|
1252
|
+
1065: <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
|
+
1066: <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
|
+
1067: <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
|
+
1068: <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
|
+
1069: <span class="ruby-identifier">duplicated_scheme</span>,
|
1257
|
+
1070: <span class="ruby-identifier">duplicated_user</span>,
|
1258
|
+
1071: <span class="ruby-identifier">duplicated_password</span>,
|
1259
|
+
1072: <span class="ruby-identifier">duplicated_host</span>,
|
1260
|
+
1073: <span class="ruby-identifier">duplicated_port</span>,
|
1261
|
+
1074: <span class="ruby-identifier">duplicated_path</span>,
|
1262
|
+
1075: <span class="ruby-identifier">duplicated_query</span>,
|
1263
|
+
1076: <span class="ruby-identifier">duplicated_fragment</span>
|
1264
|
+
1077: )
|
1265
|
+
1078: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">duplicated_uri</span>
|
1266
|
+
1079: <span class="ruby-keyword kw">end</span>
|
1267
1267
|
</pre>
|
1268
1268
|
</div>
|
1269
1269
|
</div>
|
@@ -1288,11 +1288,11 @@ href="URI.html">URI</a> before doing the comparison.
|
|
1288
1288
|
onclick="toggleCode('M000053-source');return false;">[Source]</a></p>
|
1289
1289
|
<div class="method-source-code" id="M000053-source">
|
1290
1290
|
<pre>
|
1291
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
1292
|
-
|
1293
|
-
|
1294
|
-
|
1295
|
-
|
1291
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 1053</span>
|
1292
|
+
1053: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">eql?</span>(<span class="ruby-identifier">uri</span>)
|
1293
|
+
1054: <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
|
+
1055: <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
|
+
1056: <span class="ruby-keyword kw">end</span>
|
1296
1296
|
</pre>
|
1297
1297
|
</div>
|
1298
1298
|
</div>
|
@@ -1318,11 +1318,11 @@ href="URI.html#M000030">path</a> component.
|
|
1318
1318
|
onclick="toggleCode('M000033-source');return false;">[Source]</a></p>
|
1319
1319
|
<div class="method-source-code" id="M000033-source">
|
1320
1320
|
<pre>
|
1321
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
1322
|
-
|
1323
|
-
|
1324
|
-
|
1325
|
-
|
1321
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 727</span>
|
1322
|
+
727: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">extname</span>
|
1323
|
+
728: <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
|
+
729: <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
|
+
730: <span class="ruby-keyword kw">end</span>
|
1326
1326
|
</pre>
|
1327
1327
|
</div>
|
1328
1328
|
</div>
|
@@ -1407,25 +1407,28 @@ An example:
|
|
1407
1407
|
285: <span class="ruby-identifier">capture_group</span>
|
1408
1408
|
286: <span class="ruby-keyword kw">end</span>)
|
1409
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:
|
1411
|
-
289:
|
1412
|
-
290:
|
1413
|
-
291: <span class="ruby-identifier">
|
1414
|
-
292:
|
1415
|
-
293:
|
1416
|
-
294:
|
1417
|
-
295:
|
1418
|
-
296:
|
1419
|
-
297:
|
1420
|
-
298:
|
1421
|
-
299:
|
1422
|
-
300:
|
1423
|
-
301: <span class="ruby-keyword kw">
|
1424
|
-
302:
|
1425
|
-
303:
|
1426
|
-
304: <span class="ruby-keyword kw">return</span>
|
1427
|
-
305: <span class="ruby-keyword kw">
|
1428
|
-
306:
|
1410
|
+
288:
|
1411
|
+
289: <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> <span class="ruby-operator">&&</span> <span class="ruby-identifier">variables</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
1412
|
+
290: <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>
|
1413
|
+
291: <span class="ruby-identifier">name</span> = <span class="ruby-identifier">variables</span>[<span class="ruby-identifier">i</span>]
|
1414
|
+
292: <span class="ruby-identifier">value</span> = <span class="ruby-identifier">values</span>[<span class="ruby-identifier">i</span>]
|
1415
|
+
293:
|
1416
|
+
294: <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>
|
1417
|
+
295: <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>)
|
1418
|
+
296: <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>)
|
1419
|
+
297: <span class="ruby-keyword kw">end</span>
|
1420
|
+
298: <span class="ruby-keyword kw">end</span>
|
1421
|
+
299:
|
1422
|
+
300: <span class="ruby-identifier">mapping</span>[<span class="ruby-identifier">name</span>] = <span class="ruby-identifier">value</span>
|
1423
|
+
301: <span class="ruby-keyword kw">end</span>
|
1424
|
+
302: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">mapping</span>
|
1425
|
+
303: <span class="ruby-keyword kw">elsif</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">pattern</span>
|
1426
|
+
304: <span class="ruby-keyword kw">return</span> {}
|
1427
|
+
305: <span class="ruby-keyword kw">else</span>
|
1428
|
+
306: <span class="ruby-comment cmt"># Pattern failed to match URI.</span>
|
1429
|
+
307: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
|
1430
|
+
308: <span class="ruby-keyword kw">end</span>
|
1431
|
+
309: <span class="ruby-keyword kw">end</span>
|
1429
1432
|
</pre>
|
1430
1433
|
</div>
|
1431
1434
|
</div>
|
@@ -1449,10 +1452,10 @@ href="URI.html">URI</a>.
|
|
1449
1452
|
onclick="toggleCode('M000036-source');return false;">[Source]</a></p>
|
1450
1453
|
<div class="method-source-code" id="M000036-source">
|
1451
1454
|
<pre>
|
1452
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
1453
|
-
|
1454
|
-
|
1455
|
-
|
1455
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 743</span>
|
1456
|
+
743: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fragment</span>
|
1457
|
+
744: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@fragment</span>
|
1458
|
+
745: <span class="ruby-keyword kw">end</span>
|
1456
1459
|
</pre>
|
1457
1460
|
</div>
|
1458
1461
|
</div>
|
@@ -1476,10 +1479,10 @@ href="URI.html">URI</a>.
|
|
1476
1479
|
onclick="toggleCode('M000037-source');return false;">[Source]</a></p>
|
1477
1480
|
<div class="method-source-code" id="M000037-source">
|
1478
1481
|
<pre>
|
1479
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
1480
|
-
|
1481
|
-
|
1482
|
-
|
1482
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 748</span>
|
1483
|
+
748: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fragment=</span>(<span class="ruby-identifier">new_fragment</span>)
|
1484
|
+
749: <span class="ruby-ivar">@fragment</span> = <span class="ruby-identifier">new_fragment</span>
|
1485
|
+
750: <span class="ruby-keyword kw">end</span>
|
1483
1486
|
</pre>
|
1484
1487
|
</div>
|
1485
1488
|
</div>
|
@@ -1503,10 +1506,10 @@ href="URI.html">URI</a>.
|
|
1503
1506
|
onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
|
1504
1507
|
<div class="method-source-code" id="M000021-source">
|
1505
1508
|
<pre>
|
1506
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
1507
|
-
|
1508
|
-
|
1509
|
-
|
1509
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 585</span>
|
1510
|
+
585: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">host</span>
|
1511
|
+
586: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@host</span>
|
1512
|
+
587: <span class="ruby-keyword kw">end</span>
|
1510
1513
|
</pre>
|
1511
1514
|
</div>
|
1512
1515
|
</div>
|
@@ -1530,16 +1533,16 @@ href="URI.html">URI</a>.
|
|
1530
1533
|
onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
|
1531
1534
|
<div class="method-source-code" id="M000022-source">
|
1532
1535
|
<pre>
|
1533
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
1534
|
-
|
1535
|
-
|
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>
|
1536
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 590</span>
|
1537
|
+
590: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">host=</span>(<span class="ruby-identifier">new_host</span>)
|
1538
|
+
591: <span class="ruby-ivar">@host</span> = <span class="ruby-identifier">new_host</span>
|
1539
1539
|
592:
|
1540
|
-
593: <span class="ruby-comment cmt">#
|
1541
|
-
594: <span class="ruby-
|
1542
|
-
595:
|
1540
|
+
593: <span class="ruby-comment cmt"># Reset dependant values</span>
|
1541
|
+
594: <span class="ruby-ivar">@authority</span> = <span class="ruby-keyword kw">nil</span>
|
1542
|
+
595:
|
1543
|
+
596: <span class="ruby-comment cmt"># Ensure we haven't created an invalid URI</span>
|
1544
|
+
597: <span class="ruby-identifier">validate</span>()
|
1545
|
+
598: <span class="ruby-keyword kw">end</span>
|
1543
1546
|
</pre>
|
1544
1547
|
</div>
|
1545
1548
|
</div>
|
@@ -1563,10 +1566,10 @@ object‘s state.
|
|
1563
1566
|
onclick="toggleCode('M000057-source');return false;">[Source]</a></p>
|
1564
1567
|
<div class="method-source-code" id="M000057-source">
|
1565
1568
|
<pre>
|
1566
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
1567
|
-
|
1568
|
-
|
1569
|
-
|
1569
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 1107</span>
|
1570
|
+
1107: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">inspect</span>
|
1571
|
+
1108: <span class="ruby-identifier">sprintf</span>(<span class="ruby-value str">"#<%s:%#0x URI:%s>"</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>)
|
1572
|
+
1109: <span class="ruby-keyword kw">end</span>
|
1570
1573
|
</pre>
|
1571
1574
|
</div>
|
1572
1575
|
</div>
|
@@ -1589,14 +1592,14 @@ Returns true if the <a href="URI.html">URI</a> uses an IP-based protocol.
|
|
1589
1592
|
onclick="toggleCode('M000038-source');return false;">[Source]</a></p>
|
1590
1593
|
<div class="method-source-code" id="M000038-source">
|
1591
1594
|
<pre>
|
1592
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
1593
|
-
|
1594
|
-
|
1595
|
-
|
1596
|
-
|
1597
|
-
|
1598
|
-
|
1599
|
-
|
1595
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 753</span>
|
1596
|
+
753: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ip_based?</span>
|
1597
|
+
754: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">scheme</span>
|
1598
|
+
755: <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>(
|
1599
|
+
756: <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>)
|
1600
|
+
757: <span class="ruby-keyword kw">end</span>
|
1601
|
+
758: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
|
1602
|
+
759: <span class="ruby-keyword kw">end</span>
|
1600
1603
|
</pre>
|
1601
1604
|
</div>
|
1602
1605
|
</div>
|
@@ -1647,10 +1650,10 @@ Merges two URIs together.
|
|
1647
1650
|
onclick="toggleCode('M000042-source');return false;">[Source]</a></p>
|
1648
1651
|
<div class="method-source-code" id="M000042-source">
|
1649
1652
|
<pre>
|
1650
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
1651
|
-
|
1652
|
-
|
1653
|
-
|
1653
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 863</span>
|
1654
|
+
863: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">merge</span>(<span class="ruby-identifier">uri</span>)
|
1655
|
+
864: <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>
|
1656
|
+
865: <span class="ruby-keyword kw">end</span>
|
1654
1657
|
</pre>
|
1655
1658
|
</div>
|
1656
1659
|
</div>
|
@@ -1673,10 +1676,10 @@ Destructive form of <a href="URI.html#M000042">merge</a>.
|
|
1673
1676
|
onclick="toggleCode('M000044-source');return false;">[Source]</a></p>
|
1674
1677
|
<div class="method-source-code" id="M000044-source">
|
1675
1678
|
<pre>
|
1676
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
1677
|
-
|
1678
|
-
|
1679
|
-
|
1679
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 869</span>
|
1680
|
+
869: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">merge!</span>(<span class="ruby-identifier">uri</span>)
|
1681
|
+
870: <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>))
|
1682
|
+
871: <span class="ruby-keyword kw">end</span>
|
1680
1683
|
</pre>
|
1681
1684
|
</div>
|
1682
1685
|
</div>
|
@@ -1706,75 +1709,75 @@ multiple times.
|
|
1706
1709
|
onclick="toggleCode('M000048-source');return false;">[Source]</a></p>
|
1707
1710
|
<div class="method-source-code" id="M000048-source">
|
1708
1711
|
<pre>
|
1709
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
1710
|
-
|
1711
|
-
|
1712
|
-
|
1713
|
-
|
1714
|
-
|
1715
|
-
|
1716
|
-
|
1717
|
-
|
1718
|
-
|
1719
|
-
|
1720
|
-
|
1721
|
-
|
1722
|
-
|
1723
|
-
|
1724
|
-
|
1725
|
-
|
1726
|
-
|
1727
|
-
|
1728
|
-
|
1729
|
-
|
1730
|
-
|
1731
|
-
|
1732
|
-
|
1733
|
-
|
1734
|
-
|
1735
|
-
|
1736
|
-
|
1737
|
-
|
1738
|
-
|
1739
|
-
|
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">"."</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>]
|
1712
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 940</span>
|
1713
|
+
940: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">normalize</span>
|
1714
|
+
941: <span class="ruby-identifier">normalized_scheme</span> = <span class="ruby-keyword kw">nil</span>
|
1715
|
+
942: <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>
|
1716
|
+
943: <span class="ruby-identifier">normalized_scheme</span> = <span class="ruby-value str">"svn+ssh"</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">"ssh+svn"</span>
|
1717
|
+
944: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">normalized_scheme</span> <span class="ruby-operator">==</span> <span class="ruby-value str">"feed"</span>
|
1718
|
+
945: <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>
|
1719
|
+
946: <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>(
|
1720
|
+
947: <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>
|
1721
|
+
948: <span class="ruby-keyword kw">end</span>
|
1722
|
+
949: <span class="ruby-keyword kw">end</span>
|
1723
|
+
950: <span class="ruby-identifier">normalized_user</span> = <span class="ruby-keyword kw">nil</span>
|
1724
|
+
951: <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>
|
1725
|
+
952: <span class="ruby-identifier">normalized_password</span> = <span class="ruby-keyword kw">nil</span>
|
1726
|
+
953: <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>
|
1727
|
+
954:
|
1728
|
+
955: <span class="ruby-comment cmt"># If we are using http or https and user/password are blank,</span>
|
1729
|
+
956: <span class="ruby-comment cmt"># then we remove them</span>
|
1730
|
+
957: <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">&&</span> <span class="ruby-identifier">normalized_user</span> <span class="ruby-operator">==</span> <span class="ruby-value str">""</span> <span class="ruby-operator">&&</span>
|
1731
|
+
958: (<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">""</span>)
|
1732
|
+
959: <span class="ruby-identifier">normalized_user</span> = <span class="ruby-keyword kw">nil</span>
|
1733
|
+
960: <span class="ruby-identifier">normalized_password</span> = <span class="ruby-keyword kw">nil</span>
|
1734
|
+
961: <span class="ruby-keyword kw">end</span>
|
1735
|
+
962:
|
1736
|
+
963: <span class="ruby-identifier">normalized_host</span> = <span class="ruby-keyword kw">nil</span>
|
1737
|
+
964: <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>
|
1738
|
+
965: <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>
|
1739
|
+
966: <span class="ruby-keyword kw">begin</span>
|
1740
|
+
967: <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>)
|
1741
|
+
968: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span>
|
1742
|
+
969: <span class="ruby-keyword kw">nil</span>
|
1743
1743
|
970: <span class="ruby-keyword kw">end</span>
|
1744
|
-
971:
|
1745
|
-
972:
|
1746
|
-
973:
|
1747
|
-
974: <span class="ruby-keyword kw">
|
1748
|
-
975:
|
1749
|
-
976: <span class="ruby-keyword kw">
|
1750
|
-
977: <span class="ruby-identifier">
|
1751
|
-
978:
|
1752
|
-
979: <span class="ruby-keyword kw">
|
1753
|
-
980:
|
1754
|
-
981: <span class="ruby-keyword kw">
|
1755
|
-
982: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">normalized_path</span> <span class="ruby-operator"
|
1756
|
-
983: <span class="ruby-
|
1757
|
-
984:
|
1758
|
-
985:
|
1759
|
-
986:
|
1760
|
-
987:
|
1761
|
-
988:
|
1762
|
-
989: <span class="ruby-
|
1744
|
+
971: <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">"."</span>
|
1745
|
+
972: <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>]
|
1746
|
+
973: <span class="ruby-keyword kw">end</span>
|
1747
|
+
974: <span class="ruby-keyword kw">end</span>
|
1748
|
+
975:
|
1749
|
+
976: <span class="ruby-identifier">normalized_port</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">port</span>
|
1750
|
+
977: <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>
|
1751
|
+
978: <span class="ruby-identifier">normalized_port</span> = <span class="ruby-keyword kw">nil</span>
|
1752
|
+
979: <span class="ruby-keyword kw">end</span>
|
1753
|
+
980: <span class="ruby-identifier">normalized_path</span> = <span class="ruby-keyword kw">nil</span>
|
1754
|
+
981: <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>
|
1755
|
+
982: <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>
|
1756
|
+
983: <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>)
|
1757
|
+
984: <span class="ruby-keyword kw">end</span>
|
1758
|
+
985: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">normalized_path</span> <span class="ruby-operator">==</span> <span class="ruby-value str">""</span>
|
1759
|
+
986: <span class="ruby-keyword kw">if</span> [<span class="ruby-value str">"http"</span>, <span class="ruby-value str">"https"</span>, <span class="ruby-value str">"ftp"</span>, <span class="ruby-value str">"tftp"</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">normalized_scheme</span>)
|
1760
|
+
987: <span class="ruby-identifier">normalized_path</span> = <span class="ruby-value str">"/"</span>
|
1761
|
+
988: <span class="ruby-keyword kw">end</span>
|
1762
|
+
989: <span class="ruby-keyword kw">end</span>
|
1763
1763
|
990:
|
1764
|
-
991: <span class="ruby-identifier">
|
1765
|
-
992: <span class="ruby-identifier">
|
1766
|
-
993:
|
1767
|
-
994:
|
1768
|
-
995:
|
1769
|
-
996:
|
1770
|
-
997:
|
1771
|
-
998: <span class="ruby-identifier">
|
1772
|
-
999: <span class="ruby-identifier">
|
1773
|
-
1000: <span class="ruby-identifier">
|
1774
|
-
1001: <span class="ruby-identifier">
|
1775
|
-
1002: <span class="ruby-identifier">
|
1776
|
-
1003:
|
1777
|
-
1004:
|
1764
|
+
991: <span class="ruby-identifier">normalized_query</span> = <span class="ruby-keyword kw">nil</span>
|
1765
|
+
992: <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>
|
1766
|
+
993:
|
1767
|
+
994: <span class="ruby-identifier">normalized_fragment</span> = <span class="ruby-keyword kw">nil</span>
|
1768
|
+
995: <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>
|
1769
|
+
996: <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>(
|
1770
|
+
997: <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>(
|
1771
|
+
998: <span class="ruby-identifier">normalized_scheme</span>,
|
1772
|
+
999: <span class="ruby-identifier">normalized_user</span>,
|
1773
|
+
1000: <span class="ruby-identifier">normalized_password</span>,
|
1774
|
+
1001: <span class="ruby-identifier">normalized_host</span>,
|
1775
|
+
1002: <span class="ruby-identifier">normalized_port</span>,
|
1776
|
+
1003: <span class="ruby-identifier">normalized_path</span>,
|
1777
|
+
1004: <span class="ruby-identifier">normalized_query</span>,
|
1778
|
+
1005: <span class="ruby-identifier">normalized_fragment</span>
|
1779
|
+
1006: )))
|
1780
|
+
1007: <span class="ruby-keyword kw">end</span>
|
1778
1781
|
</pre>
|
1779
1782
|
</div>
|
1780
1783
|
</div>
|
@@ -1797,10 +1800,10 @@ Destructively normalizes this <a href="URI.html">URI</a> object.
|
|
1797
1800
|
onclick="toggleCode('M000049-source');return false;">[Source]</a></p>
|
1798
1801
|
<div class="method-source-code" id="M000049-source">
|
1799
1802
|
<pre>
|
1800
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
1801
|
-
|
1802
|
-
|
1803
|
-
|
1803
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 1010</span>
|
1804
|
+
1010: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">normalize!</span>
|
1805
|
+
1011: <span class="ruby-identifier">replace_self</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">normalize</span>)
|
1806
|
+
1012: <span class="ruby-keyword kw">end</span>
|
1804
1807
|
</pre>
|
1805
1808
|
</div>
|
1806
1809
|
</div>
|
@@ -1824,10 +1827,10 @@ href="URI.html">URI</a>.
|
|
1824
1827
|
onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
|
1825
1828
|
<div class="method-source-code" id="M000017-source">
|
1826
1829
|
<pre>
|
1827
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
1828
|
-
|
1829
|
-
|
1830
|
-
|
1830
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 531</span>
|
1831
|
+
531: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">password</span>
|
1832
|
+
532: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@password</span>
|
1833
|
+
533: <span class="ruby-keyword kw">end</span>
|
1831
1834
|
</pre>
|
1832
1835
|
</div>
|
1833
1836
|
</div>
|
@@ -1851,22 +1854,22 @@ href="URI.html">URI</a>.
|
|
1851
1854
|
onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
|
1852
1855
|
<div class="method-source-code" id="M000018-source">
|
1853
1856
|
<pre>
|
1854
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
1855
|
-
|
1856
|
-
|
1857
|
-
|
1858
|
-
|
1859
|
-
|
1860
|
-
|
1861
|
-
|
1862
|
-
|
1863
|
-
|
1864
|
-
|
1865
|
-
|
1866
|
-
|
1867
|
-
|
1868
|
-
|
1869
|
-
|
1857
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 536</span>
|
1858
|
+
536: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">password=</span>(<span class="ruby-identifier">new_password</span>)
|
1859
|
+
537: <span class="ruby-ivar">@password</span> = <span class="ruby-identifier">new_password</span>
|
1860
|
+
538:
|
1861
|
+
539: <span class="ruby-comment cmt"># You can't have a nil user with a non-nil password</span>
|
1862
|
+
540: <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>
|
1863
|
+
541: <span class="ruby-ivar">@user</span> = <span class="ruby-value str">""</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@user</span>.<span class="ruby-identifier">nil?</span>
|
1864
|
+
542: <span class="ruby-keyword kw">end</span>
|
1865
|
+
543:
|
1866
|
+
544: <span class="ruby-comment cmt"># Reset dependant values</span>
|
1867
|
+
545: <span class="ruby-ivar">@userinfo</span> = <span class="ruby-keyword kw">nil</span>
|
1868
|
+
546: <span class="ruby-ivar">@authority</span> = <span class="ruby-keyword kw">nil</span>
|
1869
|
+
547:
|
1870
|
+
548: <span class="ruby-comment cmt"># Ensure we haven't created an invalid URI</span>
|
1871
|
+
549: <span class="ruby-identifier">validate</span>()
|
1872
|
+
550: <span class="ruby-keyword kw">end</span>
|
1870
1873
|
</pre>
|
1871
1874
|
</div>
|
1872
1875
|
</div>
|
@@ -1890,10 +1893,10 @@ href="URI.html">URI</a>.
|
|
1890
1893
|
onclick="toggleCode('M000030-source');return false;">[Source]</a></p>
|
1891
1894
|
<div class="method-source-code" id="M000030-source">
|
1892
1895
|
<pre>
|
1893
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
1894
|
-
|
1895
|
-
|
1896
|
-
|
1896
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 708</span>
|
1897
|
+
708: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">path</span>
|
1898
|
+
709: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@path</span>
|
1899
|
+
710: <span class="ruby-keyword kw">end</span>
|
1897
1900
|
</pre>
|
1898
1901
|
</div>
|
1899
1902
|
</div>
|
@@ -1917,10 +1920,10 @@ href="URI.html">URI</a>.
|
|
1917
1920
|
onclick="toggleCode('M000031-source');return false;">[Source]</a></p>
|
1918
1921
|
<div class="method-source-code" id="M000031-source">
|
1919
1922
|
<pre>
|
1920
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
1921
|
-
|
1922
|
-
|
1923
|
-
|
1923
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 713</span>
|
1924
|
+
713: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">path=</span>(<span class="ruby-identifier">new_path</span>)
|
1925
|
+
714: <span class="ruby-ivar">@path</span> = (<span class="ruby-identifier">new_path</span> <span class="ruby-operator">||</span> <span class="ruby-value str">""</span>)
|
1926
|
+
715: <span class="ruby-keyword kw">end</span>
|
1924
1927
|
</pre>
|
1925
1928
|
</div>
|
1926
1929
|
</div>
|
@@ -1949,20 +1952,20 @@ href="URI.html">URI</a>.
|
|
1949
1952
|
onclick="toggleCode('M000027-source');return false;">[Source]</a></p>
|
1950
1953
|
<div class="method-source-code" id="M000027-source">
|
1951
1954
|
<pre>
|
1952
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
1953
|
-
|
1954
|
-
|
1955
|
-
|
1956
|
-
|
1957
|
-
|
1958
|
-
|
1959
|
-
|
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>
|
1955
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 676</span>
|
1956
|
+
676: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">port</span>
|
1957
|
+
677: <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>
|
1958
|
+
678: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">scheme</span>
|
1959
|
+
679: <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>]
|
1960
|
+
680: <span class="ruby-keyword kw">else</span>
|
1961
|
+
681: <span class="ruby-ivar">@port</span> = <span class="ruby-keyword kw">nil</span>
|
1962
|
+
682: <span class="ruby-keyword kw">end</span>
|
1963
1963
|
683: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@port</span>
|
1964
|
-
684: <span class="ruby-keyword kw">
|
1965
|
-
685:
|
1964
|
+
684: <span class="ruby-keyword kw">else</span>
|
1965
|
+
685: <span class="ruby-ivar">@port</span> = <span class="ruby-ivar">@port</span>.<span class="ruby-identifier">to_i</span>
|
1966
|
+
686: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@port</span>
|
1967
|
+
687: <span class="ruby-keyword kw">end</span>
|
1968
|
+
688: <span class="ruby-keyword kw">end</span>
|
1966
1969
|
</pre>
|
1967
1970
|
</div>
|
1968
1971
|
</div>
|
@@ -1986,12 +1989,12 @@ href="URI.html">URI</a>.
|
|
1986
1989
|
onclick="toggleCode('M000028-source');return false;">[Source]</a></p>
|
1987
1990
|
<div class="method-source-code" id="M000028-source">
|
1988
1991
|
<pre>
|
1989
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
1990
|
-
|
1991
|
-
|
1992
|
-
|
1993
|
-
|
1994
|
-
|
1992
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 691</span>
|
1993
|
+
691: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">port=</span>(<span class="ruby-identifier">new_port</span>)
|
1994
|
+
692: <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>
|
1995
|
+
693: <span class="ruby-ivar">@specified_port</span> = <span class="ruby-ivar">@port</span>
|
1996
|
+
694: <span class="ruby-ivar">@authority</span> = <span class="ruby-keyword kw">nil</span>
|
1997
|
+
695: <span class="ruby-keyword kw">end</span>
|
1995
1998
|
</pre>
|
1996
1999
|
</div>
|
1997
2000
|
</div>
|
@@ -2015,10 +2018,10 @@ href="URI.html">URI</a>.
|
|
2015
2018
|
onclick="toggleCode('M000034-source');return false;">[Source]</a></p>
|
2016
2019
|
<div class="method-source-code" id="M000034-source">
|
2017
2020
|
<pre>
|
2018
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
2019
|
-
|
2020
|
-
|
2021
|
-
|
2021
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 733</span>
|
2022
|
+
733: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">query</span>
|
2023
|
+
734: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@query</span>
|
2024
|
+
735: <span class="ruby-keyword kw">end</span>
|
2022
2025
|
</pre>
|
2023
2026
|
</div>
|
2024
2027
|
</div>
|
@@ -2042,10 +2045,10 @@ href="URI.html">URI</a>.
|
|
2042
2045
|
onclick="toggleCode('M000035-source');return false;">[Source]</a></p>
|
2043
2046
|
<div class="method-source-code" id="M000035-source">
|
2044
2047
|
<pre>
|
2045
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
2046
|
-
|
2047
|
-
|
2048
|
-
|
2048
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 738</span>
|
2049
|
+
738: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">query=</span>(<span class="ruby-identifier">new_query</span>)
|
2050
|
+
739: <span class="ruby-ivar">@query</span> = <span class="ruby-identifier">new_query</span>
|
2051
|
+
740: <span class="ruby-keyword kw">end</span>
|
2049
2052
|
</pre>
|
2050
2053
|
</div>
|
2051
2054
|
</div>
|
@@ -2068,10 +2071,10 @@ Returns true if this <a href="URI.html">URI</a> is known to be relative.
|
|
2068
2071
|
onclick="toggleCode('M000039-source');return false;">[Source]</a></p>
|
2069
2072
|
<div class="method-source-code" id="M000039-source">
|
2070
2073
|
<pre>
|
2071
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
2072
|
-
|
2073
|
-
|
2074
|
-
|
2074
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 762</span>
|
2075
|
+
762: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">relative?</span>
|
2076
|
+
763: <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>
|
2077
|
+
764: <span class="ruby-keyword kw">end</span>
|
2075
2078
|
</pre>
|
2076
2079
|
</div>
|
2077
2080
|
</div>
|
@@ -2097,55 +2100,55 @@ necessary.
|
|
2097
2100
|
onclick="toggleCode('M000046-source');return false;">[Source]</a></p>
|
2098
2101
|
<div class="method-source-code" id="M000046-source">
|
2099
2102
|
<pre>
|
2100
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
2101
|
-
|
2102
|
-
|
2103
|
-
|
2104
|
-
|
2105
|
-
|
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">"Expected absolute URI, got: #{uri.to_s}"</span>
|
2103
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 877</span>
|
2104
|
+
877: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">route_from</span>(<span class="ruby-identifier">uri</span>)
|
2105
|
+
878: <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>
|
2106
|
+
879: <span class="ruby-identifier">normalized_self</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">normalize</span>
|
2107
|
+
880: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">normalized_self</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">"Expected absolute URI, got: #{self.to_s}"</span>
|
2109
2109
|
882: <span class="ruby-keyword kw">end</span>
|
2110
|
-
883: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">
|
2111
|
-
884: <span class="ruby-
|
2110
|
+
883: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">relative?</span>
|
2111
|
+
884: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">"Expected absolute URI, got: #{uri.to_s}"</span>
|
2112
2112
|
885: <span class="ruby-keyword kw">end</span>
|
2113
|
-
886: <span class="ruby-
|
2114
|
-
887:
|
2115
|
-
888:
|
2116
|
-
889:
|
2117
|
-
890:
|
2118
|
-
891:
|
2119
|
-
892:
|
2120
|
-
893: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:
|
2121
|
-
894: <span class="ruby-
|
2122
|
-
895:
|
2123
|
-
896:
|
2124
|
-
897:
|
2125
|
-
898: <span class="ruby-keyword kw">
|
2126
|
-
899:
|
2127
|
-
900:
|
2128
|
-
901:
|
2129
|
-
902:
|
2130
|
-
903: <span class="ruby-keyword kw">
|
2131
|
-
904:
|
2132
|
-
905:
|
2133
|
-
906:
|
2134
|
-
907:
|
2135
|
-
908:
|
2136
|
-
909:
|
2137
|
-
910: <span class="ruby-
|
2138
|
-
911: <span class="ruby-keyword kw">
|
2139
|
-
912: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:scheme</span>]
|
2140
|
-
913:
|
2141
|
-
914:
|
2142
|
-
915: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:
|
2143
|
-
916: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:
|
2144
|
-
917: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:
|
2145
|
-
918: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:
|
2146
|
-
919: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:
|
2147
|
-
920:
|
2148
|
-
921:
|
2113
|
+
886: <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>
|
2114
|
+
887: <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">"##{normalized_self.fragment}"</span>)
|
2115
|
+
888: <span class="ruby-keyword kw">end</span>
|
2116
|
+
889: <span class="ruby-identifier">segments</span> = <span class="ruby-identifier">normalized_self</span>.<span class="ruby-identifier">to_hash</span>
|
2117
|
+
890: <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>
|
2118
|
+
891: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:scheme</span>] = <span class="ruby-keyword kw">nil</span>
|
2119
|
+
892: <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>
|
2120
|
+
893: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:user</span>] = <span class="ruby-keyword kw">nil</span>
|
2121
|
+
894: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:password</span>] = <span class="ruby-keyword kw">nil</span>
|
2122
|
+
895: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:host</span>] = <span class="ruby-keyword kw">nil</span>
|
2123
|
+
896: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:port</span>] = <span class="ruby-keyword kw">nil</span>
|
2124
|
+
897: <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>
|
2125
|
+
898: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:path</span>] = <span class="ruby-keyword kw">nil</span>
|
2126
|
+
899: <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>
|
2127
|
+
900: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:query</span>] = <span class="ruby-keyword kw">nil</span>
|
2128
|
+
901: <span class="ruby-keyword kw">end</span>
|
2129
|
+
902: <span class="ruby-keyword kw">else</span>
|
2130
|
+
903: <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">"/"</span>
|
2131
|
+
904: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:path</span>].<span class="ruby-identifier">gsub!</span>(
|
2132
|
+
905: <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">"^"</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">""</span>)
|
2133
|
+
906: <span class="ruby-keyword kw">end</span>
|
2134
|
+
907: <span class="ruby-keyword kw">end</span>
|
2135
|
+
908: <span class="ruby-keyword kw">end</span>
|
2136
|
+
909: <span class="ruby-keyword kw">end</span>
|
2137
|
+
910: <span class="ruby-comment cmt"># Avoid network-path references.</span>
|
2138
|
+
911: <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>
|
2139
|
+
912: <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>
|
2140
|
+
913: <span class="ruby-keyword kw">end</span>
|
2141
|
+
914: <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>(
|
2142
|
+
915: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:scheme</span>],
|
2143
|
+
916: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:user</span>],
|
2144
|
+
917: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:password</span>],
|
2145
|
+
918: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:host</span>],
|
2146
|
+
919: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:port</span>],
|
2147
|
+
920: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:path</span>],
|
2148
|
+
921: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:query</span>],
|
2149
|
+
922: <span class="ruby-identifier">segments</span>[<span class="ruby-identifier">:fragment</span>]
|
2150
|
+
923: )
|
2151
|
+
924: <span class="ruby-keyword kw">end</span>
|
2149
2152
|
</pre>
|
2150
2153
|
</div>
|
2151
2154
|
</div>
|
@@ -2171,10 +2174,10 @@ necessary.
|
|
2171
2174
|
onclick="toggleCode('M000047-source');return false;">[Source]</a></p>
|
2172
2175
|
<div class="method-source-code" id="M000047-source">
|
2173
2176
|
<pre>
|
2174
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
2175
|
-
|
2176
|
-
|
2177
|
-
|
2177
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 929</span>
|
2178
|
+
929: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">route_to</span>(<span class="ruby-identifier">uri</span>)
|
2179
|
+
930: <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>)
|
2180
|
+
931: <span class="ruby-keyword kw">end</span>
|
2178
2181
|
</pre>
|
2179
2182
|
</div>
|
2180
2183
|
</div>
|
@@ -2198,10 +2201,10 @@ href="URI.html">URI</a>.
|
|
2198
2201
|
onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
|
2199
2202
|
<div class="method-source-code" id="M000013-source">
|
2200
2203
|
<pre>
|
2201
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
2202
|
-
|
2203
|
-
|
2204
|
-
|
2204
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 499</span>
|
2205
|
+
499: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">scheme</span>
|
2206
|
+
500: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@scheme</span>
|
2207
|
+
501: <span class="ruby-keyword kw">end</span>
|
2205
2208
|
</pre>
|
2206
2209
|
</div>
|
2207
2210
|
</div>
|
@@ -2225,10 +2228,10 @@ href="URI.html">URI</a>.)
|
|
2225
2228
|
onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
|
2226
2229
|
<div class="method-source-code" id="M000014-source">
|
2227
2230
|
<pre>
|
2228
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
2229
|
-
|
2230
|
-
|
2231
|
-
|
2231
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 504</span>
|
2232
|
+
504: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">scheme=</span>(<span class="ruby-identifier">new_scheme</span>)
|
2233
|
+
505: <span class="ruby-ivar">@scheme</span> = <span class="ruby-identifier">new_scheme</span>
|
2234
|
+
506: <span class="ruby-keyword kw">end</span>
|
2232
2235
|
</pre>
|
2233
2236
|
</div>
|
2234
2237
|
</div>
|
@@ -2252,15 +2255,15 @@ specified in the <a href="URI.html">URI</a> string.
|
|
2252
2255
|
onclick="toggleCode('M000029-source');return false;">[Source]</a></p>
|
2253
2256
|
<div class="method-source-code" id="M000029-source">
|
2254
2257
|
<pre>
|
2255
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
2256
|
-
|
2257
|
-
|
2258
|
-
|
2259
|
-
|
2260
|
-
|
2261
|
-
|
2262
|
-
|
2263
|
-
|
2258
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 698</span>
|
2259
|
+
698: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">specified_port</span>
|
2260
|
+
699: <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>
|
2261
|
+
700: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">port</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
|
2262
|
+
701: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
|
2263
|
+
702: <span class="ruby-keyword kw">else</span>
|
2264
|
+
703: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">port</span>
|
2265
|
+
704: <span class="ruby-keyword kw">end</span>
|
2266
|
+
705: <span class="ruby-keyword kw">end</span>
|
2264
2267
|
</pre>
|
2265
2268
|
</div>
|
2266
2269
|
</div>
|
@@ -2283,19 +2286,19 @@ Returns a Hash of the <a href="URI.html">URI</a> segments.
|
|
2283
2286
|
onclick="toggleCode('M000056-source');return false;">[Source]</a></p>
|
2284
2287
|
<div class="method-source-code" id="M000056-source">
|
2285
2288
|
<pre>
|
2286
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
2287
|
-
|
2288
|
-
|
2289
|
-
|
2290
|
-
|
2291
|
-
|
2292
|
-
|
2293
|
-
|
2294
|
-
|
2295
|
-
|
2296
|
-
|
2297
|
-
|
2298
|
-
|
2289
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 1093</span>
|
2290
|
+
1093: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_hash</span>
|
2291
|
+
1094: <span class="ruby-keyword kw">return</span> {
|
2292
|
+
1095: <span class="ruby-identifier">:scheme</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">scheme</span>,
|
2293
|
+
1096: <span class="ruby-identifier">:user</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">user</span>,
|
2294
|
+
1097: <span class="ruby-identifier">:password</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">password</span>,
|
2295
|
+
1098: <span class="ruby-identifier">:host</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">host</span>,
|
2296
|
+
1099: <span class="ruby-identifier">:port</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">specified_port</span>,
|
2297
|
+
1100: <span class="ruby-identifier">:path</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">path</span>,
|
2298
|
+
1101: <span class="ruby-identifier">:query</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">query</span>,
|
2299
|
+
1102: <span class="ruby-identifier">:fragment</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fragment</span>
|
2300
|
+
1103: }
|
2301
|
+
1104: <span class="ruby-keyword kw">end</span>
|
2299
2302
|
</pre>
|
2300
2303
|
</div>
|
2301
2304
|
</div>
|
@@ -2318,16 +2321,16 @@ Returns the assembled <a href="URI.html">URI</a> as a string.
|
|
2318
2321
|
onclick="toggleCode('M000055-source');return false;">[Source]</a></p>
|
2319
2322
|
<div class="method-source-code" id="M000055-source">
|
2320
2323
|
<pre>
|
2321
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
2322
|
-
|
2323
|
-
|
2324
|
-
|
2325
|
-
|
2326
|
-
|
2327
|
-
|
2328
|
-
|
2329
|
-
|
2330
|
-
|
2324
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 1082</span>
|
2325
|
+
1082: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
|
2326
|
+
1083: <span class="ruby-identifier">uri_string</span> = <span class="ruby-value str">""</span>
|
2327
|
+
1084: <span class="ruby-identifier">uri_string</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"#{self.scheme}:"</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>
|
2328
|
+
1085: <span class="ruby-identifier">uri_string</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"//#{self.authority}"</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>
|
2329
|
+
1086: <span class="ruby-identifier">uri_string</span> <span class="ruby-operator"><<</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">path</span>.<span class="ruby-identifier">to_s</span>
|
2330
|
+
1087: <span class="ruby-identifier">uri_string</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"?#{self.query}"</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>
|
2331
|
+
1088: <span class="ruby-identifier">uri_string</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"##{self.fragment}"</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>
|
2332
|
+
1089: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">uri_string</span>
|
2333
|
+
1090: <span class="ruby-keyword kw">end</span>
|
2331
2334
|
</pre>
|
2332
2335
|
</div>
|
2333
2336
|
</div>
|
@@ -2351,10 +2354,10 @@ href="URI.html">URI</a>.
|
|
2351
2354
|
onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
|
2352
2355
|
<div class="method-source-code" id="M000015-source">
|
2353
2356
|
<pre>
|
2354
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
2355
|
-
|
2356
|
-
|
2357
|
-
|
2357
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 509</span>
|
2358
|
+
509: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">user</span>
|
2359
|
+
510: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@user</span>
|
2360
|
+
511: <span class="ruby-keyword kw">end</span>
|
2358
2361
|
</pre>
|
2359
2362
|
</div>
|
2360
2363
|
</div>
|
@@ -2378,22 +2381,22 @@ href="URI.html">URI</a>.
|
|
2378
2381
|
onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
|
2379
2382
|
<div class="method-source-code" id="M000016-source">
|
2380
2383
|
<pre>
|
2381
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
2382
|
-
|
2383
|
-
|
2384
|
-
|
2385
|
-
|
2386
|
-
|
2387
|
-
|
2388
|
-
|
2389
|
-
|
2390
|
-
|
2391
|
-
|
2392
|
-
|
2393
|
-
|
2394
|
-
|
2395
|
-
|
2396
|
-
|
2384
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 514</span>
|
2385
|
+
514: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">user=</span>(<span class="ruby-identifier">new_user</span>)
|
2386
|
+
515: <span class="ruby-ivar">@user</span> = <span class="ruby-identifier">new_user</span>
|
2387
|
+
516:
|
2388
|
+
517: <span class="ruby-comment cmt"># You can't have a nil user with a non-nil password</span>
|
2389
|
+
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>
|
2390
|
+
519: <span class="ruby-ivar">@user</span> = <span class="ruby-value str">""</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@user</span>.<span class="ruby-identifier">nil?</span>
|
2391
|
+
520: <span class="ruby-keyword kw">end</span>
|
2392
|
+
521:
|
2393
|
+
522: <span class="ruby-comment cmt"># Reset dependant values</span>
|
2394
|
+
523: <span class="ruby-ivar">@userinfo</span> = <span class="ruby-keyword kw">nil</span>
|
2395
|
+
524: <span class="ruby-ivar">@authority</span> = <span class="ruby-keyword kw">nil</span>
|
2396
|
+
525:
|
2397
|
+
526: <span class="ruby-comment cmt"># Ensure we haven't created an invalid URI</span>
|
2398
|
+
527: <span class="ruby-identifier">validate</span>()
|
2399
|
+
528: <span class="ruby-keyword kw">end</span>
|
2397
2400
|
</pre>
|
2398
2401
|
</div>
|
2399
2402
|
</div>
|
@@ -2417,21 +2420,21 @@ this <a href="URI.html">URI</a>.
|
|
2417
2420
|
onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
|
2418
2421
|
<div class="method-source-code" id="M000019-source">
|
2419
2422
|
<pre>
|
2420
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
2421
|
-
|
2422
|
-
|
2423
|
-
|
2424
|
-
|
2425
|
-
|
2426
|
-
|
2427
|
-
|
2428
|
-
|
2429
|
-
|
2430
|
-
|
2431
|
-
|
2432
|
-
|
2433
|
-
|
2434
|
-
|
2423
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 553</span>
|
2424
|
+
553: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">userinfo</span>
|
2425
|
+
554: <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>
|
2426
|
+
555: <span class="ruby-identifier">current_user</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">user</span>
|
2427
|
+
556: <span class="ruby-identifier">current_password</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">password</span>
|
2428
|
+
557: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">current_user</span> <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-identifier">current_password</span>
|
2429
|
+
558: <span class="ruby-ivar">@userinfo</span> = <span class="ruby-keyword kw">nil</span>
|
2430
|
+
559: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">current_user</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">current_password</span>
|
2431
|
+
560: <span class="ruby-ivar">@userinfo</span> = <span class="ruby-node">"#{current_user}:#{current_password}"</span>
|
2432
|
+
561: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">current_user</span> <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-identifier">current_password</span>
|
2433
|
+
562: <span class="ruby-ivar">@userinfo</span> = <span class="ruby-node">"#{current_user}"</span>
|
2434
|
+
563: <span class="ruby-keyword kw">end</span>
|
2435
|
+
564: <span class="ruby-keyword kw">end</span>
|
2436
|
+
565: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@userinfo</span>
|
2437
|
+
566: <span class="ruby-keyword kw">end</span>
|
2435
2438
|
</pre>
|
2436
2439
|
</div>
|
2437
2440
|
</div>
|
@@ -2455,21 +2458,21 @@ this <a href="URI.html">URI</a>.
|
|
2455
2458
|
onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
|
2456
2459
|
<div class="method-source-code" id="M000020-source">
|
2457
2460
|
<pre>
|
2458
|
-
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line
|
2459
|
-
|
2460
|
-
|
2461
|
-
|
2462
|
-
|
2463
|
-
|
2464
|
-
|
2465
|
-
|
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>
|
2461
|
+
<span class="ruby-comment cmt"># File lib/addressable/uri.rb, line 569</span>
|
2462
|
+
569: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">userinfo=</span>(<span class="ruby-identifier">new_userinfo</span>)
|
2463
|
+
570: <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>]
|
2464
|
+
571: <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>]
|
2465
|
+
572:
|
2466
|
+
573: <span class="ruby-comment cmt"># Password assigned first to ensure validity in case of nil</span>
|
2467
|
+
574: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">password</span> = <span class="ruby-identifier">new_password</span>
|
2468
|
+
575: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">user</span> = <span class="ruby-identifier">new_user</span>
|
2469
2469
|
576:
|
2470
|
-
577: <span class="ruby-comment cmt">#
|
2471
|
-
578: <span class="ruby-
|
2472
|
-
579:
|
2470
|
+
577: <span class="ruby-comment cmt"># Reset dependant values</span>
|
2471
|
+
578: <span class="ruby-ivar">@authority</span> = <span class="ruby-keyword kw">nil</span>
|
2472
|
+
579:
|
2473
|
+
580: <span class="ruby-comment cmt"># Ensure we haven't created an invalid URI</span>
|
2474
|
+
581: <span class="ruby-identifier">validate</span>()
|
2475
|
+
582: <span class="ruby-keyword kw">end</span>
|
2473
2476
|
</pre>
|
2474
2477
|
</div>
|
2475
2478
|
</div>
|