Blame view

doc/classes/String.html 10.7 KB
7043da90b   Romain Deveaud   first commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <title>Class: String [RDoc Documentation]</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="Content-Script-Type" content="text/javascript" />
    <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
    <script type="text/javascript">
    // <![CDATA[
  
    function popupCode( url ) {
      window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
    }
  
    function toggleCode( id ) {
      if ( document.getElementById )
        elem = document.getElementById( id );
      else if ( document.all )
        elem = eval( "document.all." + id );
      else
        return false;
  
      elemStyle = elem.style;
  
      if ( elemStyle.display != "block" ) {
        elemStyle.display = "block"
      } else {
        elemStyle.display = "none"
      }
  
      return true;
    }
  
    // Make codeblocks hidden by default
    document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }<\/style>" )
  
    // ]]>
    </script>
  
  </head>
  <body>
  
  
      <div id="classHeader">
          <table class="header-table">
          <tr class="top-aligned-row">
            <td><strong>Class</strong></td>
            <td class="class-name-in-header">String</td>
          </tr>
          <tr class="top-aligned-row">
              <td><strong>In:</strong></td>
              <td>
  
  
                  <a href="../files/lib/rir/string_rb.html">
  
                  lib/rir/string.rb
  
                  </a>
  
  
          <br />
  
              </td>
          </tr>
  
  
          <tr class="top-aligned-row">
              <td><strong>Parent:</strong></td>
              <td>
  
                  Object
  
              </td>
          </tr>
  
          </table>
      </div>
    <!-- banner header -->
  
    <div id="bodyContent">
  
    <div id="contextContent">
  
      <div id="description">
        <p>
  Extention of the standard class <a href="String.html">String</a> with
  useful function.
  </p>
  
      </div>
  
     </div>
  
  
      <div id="method-list">
        <h3 class="section-bar">Methods</h3>
  
        <div class="name-list">
4b35d2227   Romain Deveaud   resolving documen...
101
          <a href="#M000012">extract_xmltags_values</a>&nbsp;&nbsp;
7043da90b   Romain Deveaud   first commit
102

4b35d2227   Romain Deveaud   resolving documen...
103
          <a href="#M000002">is_stopword?</a>&nbsp;&nbsp;
7043da90b   Romain Deveaud   first commit
104

4b35d2227   Romain Deveaud   resolving documen...
105
          <a href="#M000003">remove_special_characters</a>&nbsp;&nbsp;
7043da90b   Romain Deveaud   first commit
106

4b35d2227   Romain Deveaud   resolving documen...
107
          <a href="#M000007">strip_javascripts</a>&nbsp;&nbsp;
7043da90b   Romain Deveaud   first commit
108

4b35d2227   Romain Deveaud   resolving documen...
109
          <a href="#M000006">strip_javascripts!</a>&nbsp;&nbsp;
7043da90b   Romain Deveaud   first commit
110

4b35d2227   Romain Deveaud   resolving documen...
111
          <a href="#M000011">strip_punctuation</a>&nbsp;&nbsp;
bc18b961b   Romain Deveaud   more doc
112

4b35d2227   Romain Deveaud   resolving documen...
113
          <a href="#M000010">strip_punctuation!</a>&nbsp;&nbsp;
bc18b961b   Romain Deveaud   more doc
114

4b35d2227   Romain Deveaud   resolving documen...
115
          <a href="#M000009">strip_stylesheets</a>&nbsp;&nbsp;
7043da90b   Romain Deveaud   first commit
116

4b35d2227   Romain Deveaud   resolving documen...
117
          <a href="#M000008">strip_stylesheets!</a>&nbsp;&nbsp;
7043da90b   Romain Deveaud   first commit
118

4b35d2227   Romain Deveaud   resolving documen...
119
          <a href="#M000005">strip_xml_tags</a>&nbsp;&nbsp;
7043da90b   Romain Deveaud   first commit
120

4b35d2227   Romain Deveaud   resolving documen...
121
          <a href="#M000004">strip_xml_tags!</a>&nbsp;&nbsp;
7043da90b   Romain Deveaud   first commit
122
123
124
125
126
127
128
129
130
131
132
133
  
        </div>
      </div>
  
    </div>
  
      <!-- if includes -->
  
      <div id="includes">
        <h3 class="section-bar">Included Modules</h3>
  
        <div id="includes-list">
fd4cb285a   Romain Deveaud   doc changes + doc...
134
          <span class="include-name"><a href="RIR.html">RIR</a></span>
7043da90b   Romain Deveaud   first commit
135
136
137
138
139
140
141
142
143
144
145
146
147
148
  
        </div>
      </div>
  
      <div id="section">
  
  
  
  
      <!-- if method_list -->
  
      <div id="methods">
  
        <h3 class="section-bar">Public Instance methods</h3>
4b35d2227   Romain Deveaud   resolving documen...
149
150
        <div id="method-M000012" class="method-detail">
          <a name="M000012"></a>
7043da90b   Romain Deveaud   first commit
151
152
  
          <div class="method-heading">
4b35d2227   Romain Deveaud   resolving documen...
153
154
            <a href="String.src/M000012.html" target="Code" class="method-signature"
              onclick="popupCode('String.src/M000012.html');return false;">
7043da90b   Romain Deveaud   first commit
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
  
            <span class="method-name">extract_xmltags_values</span><span class="method-args">(tag_name)</span>
  
            </a>
  
          </div>
  
          <div class="method-description">
  
            <p>
  Returns the text values inside all occurences of a XML tag in <tt>self</tt>
  </p>
  <pre>
    s = &quot;four-piece in &lt;a href='#'&gt;Indianapolis&lt;/a&gt;, &lt;a href='#'&gt;Indiana&lt;/a&gt; at the Murat Theatre&quot;
    s.extract_xmltags_values 'a' #=&gt; [&quot;Indianapolis&quot;, &quot;Indiana&quot;]
  </pre>
  
          </div>
        </div>
4b35d2227   Romain Deveaud   resolving documen...
174
175
        <div id="method-M000002" class="method-detail">
          <a name="M000002"></a>
7043da90b   Romain Deveaud   first commit
176
177
  
          <div class="method-heading">
4b35d2227   Romain Deveaud   resolving documen...
178
179
            <a href="String.src/M000002.html" target="Code" class="method-signature"
              onclick="popupCode('String.src/M000002.html');return false;">
7043da90b   Romain Deveaud   first commit
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
  
            <span class="method-name">is_stopword?</span><span class="method-args">()</span>
  
            </a>
  
          </div>
  
          <div class="method-description">
  
            <p>
  Returns <tt>true</tt> if <tt>self</tt> belongs to Rir::Stoplist,
  <tt>false</tt> otherwise.
  </p>
  
          </div>
        </div>
4b35d2227   Romain Deveaud   resolving documen...
196
197
        <div id="method-M000003" class="method-detail">
          <a name="M000003"></a>
7043da90b   Romain Deveaud   first commit
198
199
  
          <div class="method-heading">
4b35d2227   Romain Deveaud   resolving documen...
200
201
            <a href="String.src/M000003.html" target="Code" class="method-signature"
              onclick="popupCode('String.src/M000003.html');return false;">
7043da90b   Romain Deveaud   first commit
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
  
            <span class="method-name">remove_special_characters</span><span class="method-args">()</span>
  
            </a>
  
          </div>
  
          <div class="method-description">
  
            <p>
  Do not use. TODO: rewamp. find why this function is here.
  </p>
  
          </div>
        </div>
4b35d2227   Romain Deveaud   resolving documen...
217
218
        <div id="method-M000007" class="method-detail">
          <a name="M000007"></a>
7043da90b   Romain Deveaud   first commit
219
220
  
          <div class="method-heading">
4b35d2227   Romain Deveaud   resolving documen...
221
222
            <a href="String.src/M000007.html" target="Code" class="method-signature"
              onclick="popupCode('String.src/M000007.html');return false;">
7043da90b   Romain Deveaud   first commit
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
  
            <span class="method-name">strip_javascripts</span><span class="method-args">()</span>
  
            </a>
  
          </div>
  
          <div class="method-description">
  
            <p>
  Removes all Javascript sources from <tt>self</tt>.
  </p>
  <pre>
    s = &quot;&lt;script type='text/javascript'&gt;
          var skin='vector',
          stylepath='http://bits.wikimedia.org/skins-1.5'
         &lt;/script&gt;
  
         test&quot;
    s.strip_javascripts                   #=&gt; &quot;test&quot;
  </pre>
  
          </div>
        </div>
4b35d2227   Romain Deveaud   resolving documen...
247
248
        <div id="method-M000006" class="method-detail">
          <a name="M000006"></a>
7043da90b   Romain Deveaud   first commit
249
250
  
          <div class="method-heading">
4b35d2227   Romain Deveaud   resolving documen...
251
252
            <a href="String.src/M000006.html" target="Code" class="method-signature"
              onclick="popupCode('String.src/M000006.html');return false;">
7043da90b   Romain Deveaud   first commit
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
  
            <span class="method-name">strip_javascripts!</span><span class="method-args">()</span>
  
            </a>
  
          </div>
  
          <div class="method-description">
  
            <p>
  Removes all Javascript sources from <tt>self</tt>.
  </p>
  <pre>
    s = &quot;&lt;script type='text/javascript'&gt;
          var skin='vector',
          stylepath='http://bits.wikimedia.org/skins-1.5'
         &lt;/script&gt;
  
         test&quot;
    s.strip_javascripts!
    s                                     #=&gt; &quot;test&quot;
  </pre>
  
          </div>
        </div>
4b35d2227   Romain Deveaud   resolving documen...
278
279
        <div id="method-M000011" class="method-detail">
          <a name="M000011"></a>
bc18b961b   Romain Deveaud   more doc
280
281
  
          <div class="method-heading">
4b35d2227   Romain Deveaud   resolving documen...
282
283
            <a href="String.src/M000011.html" target="Code" class="method-signature"
              onclick="popupCode('String.src/M000011.html');return false;">
bc18b961b   Romain Deveaud   more doc
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
  
            <span class="method-name">strip_punctuation</span><span class="method-args">()</span>
  
            </a>
  
          </div>
  
          <div class="method-description">
  
            <p>
  Removes punctuation from <tt>self</tt>.
  </p>
  <pre>
    s = &quot;hello, world. how are you?!&quot;
    s.strip_punctuation               # =&gt; &quot;hello world how are you&quot;
  </pre>
  
          </div>
        </div>
4b35d2227   Romain Deveaud   resolving documen...
303
304
        <div id="method-M000010" class="method-detail">
          <a name="M000010"></a>
bc18b961b   Romain Deveaud   more doc
305
306
  
          <div class="method-heading">
4b35d2227   Romain Deveaud   resolving documen...
307
308
            <a href="String.src/M000010.html" target="Code" class="method-signature"
              onclick="popupCode('String.src/M000010.html');return false;">
bc18b961b   Romain Deveaud   more doc
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
  
            <span class="method-name">strip_punctuation!</span><span class="method-args">()</span>
  
            </a>
  
          </div>
  
          <div class="method-description">
  
            <p>
  Removes punctuation from <tt>self</tt>.
  </p>
  <pre>
    s = &quot;hello, world. how are you?!&quot;
    s.strip_punctuation!
    s                                 # =&gt; &quot;hello world how are you&quot;
  </pre>
  
          </div>
        </div>
4b35d2227   Romain Deveaud   resolving documen...
329
330
        <div id="method-M000009" class="method-detail">
          <a name="M000009"></a>
7043da90b   Romain Deveaud   first commit
331
332
  
          <div class="method-heading">
4b35d2227   Romain Deveaud   resolving documen...
333
334
            <a href="String.src/M000009.html" target="Code" class="method-signature"
              onclick="popupCode('String.src/M000009.html');return false;">
7043da90b   Romain Deveaud   first commit
335
336
337
338
339
340
341
342
343
344
345
  
            <span class="method-name">strip_stylesheets</span><span class="method-args">()</span>
  
            </a>
  
          </div>
  
          <div class="method-description">
  
          </div>
        </div>
4b35d2227   Romain Deveaud   resolving documen...
346
347
        <div id="method-M000008" class="method-detail">
          <a name="M000008"></a>
7043da90b   Romain Deveaud   first commit
348
349
  
          <div class="method-heading">
4b35d2227   Romain Deveaud   resolving documen...
350
351
            <a href="String.src/M000008.html" target="Code" class="method-signature"
              onclick="popupCode('String.src/M000008.html');return false;">
7043da90b   Romain Deveaud   first commit
352
353
354
355
356
357
358
359
360
361
362
  
            <span class="method-name">strip_stylesheets!</span><span class="method-args">()</span>
  
            </a>
  
          </div>
  
          <div class="method-description">
  
          </div>
        </div>
4b35d2227   Romain Deveaud   resolving documen...
363
364
        <div id="method-M000005" class="method-detail">
          <a name="M000005"></a>
7043da90b   Romain Deveaud   first commit
365
366
  
          <div class="method-heading">
4b35d2227   Romain Deveaud   resolving documen...
367
368
            <a href="String.src/M000005.html" target="Code" class="method-signature"
              onclick="popupCode('String.src/M000005.html');return false;">
7043da90b   Romain Deveaud   first commit
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
  
            <span class="method-name">strip_xml_tags</span><span class="method-args">()</span>
  
            </a>
  
          </div>
  
          <div class="method-description">
  
            <p>
  Removes all XML-like tags from <tt>self</tt>.
  </p>
  <pre>
    s = &quot;&lt;html&gt;&lt;body&gt;test&lt;/body&gt;&lt;/html&gt;&quot;
    s.strip_xml_tags                      #=&gt; &quot;test&quot;
    s                                     #=&gt; &quot;&lt;html&gt;&lt;body&gt;test&lt;/body&gt;&lt;/html&gt;&quot;
  </pre>
  
          </div>
        </div>
4b35d2227   Romain Deveaud   resolving documen...
389
390
        <div id="method-M000004" class="method-detail">
          <a name="M000004"></a>
7043da90b   Romain Deveaud   first commit
391
392
  
          <div class="method-heading">
4b35d2227   Romain Deveaud   resolving documen...
393
394
            <a href="String.src/M000004.html" target="Code" class="method-signature"
              onclick="popupCode('String.src/M000004.html');return false;">
7043da90b   Romain Deveaud   first commit
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
  
            <span class="method-name">strip_xml_tags!</span><span class="method-args">()</span>
  
            </a>
  
          </div>
  
          <div class="method-description">
  
            <p>
  Removes all XML-like tags from <tt>self</tt>.
  </p>
  <pre>
    s = &quot;&lt;html&gt;&lt;body&gt;test&lt;/body&gt;&lt;/html&gt;&quot;
    s.strip_xml_tags!
    s                                     #=&gt; &quot;test&quot;
  </pre>
  
          </div>
        </div>
  
  
  
      </div>
  
  
  
  
    </div>
  
  <div id="validator-badges">
    <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
  </div>
  
  </body>
  </html>