]> git.r.bdr.sh - rbdr/lyricli.rb/blame_incremental - doc/Lyricli/Util.html
Add dangling files
[rbdr/lyricli.rb] / doc / Lyricli / Util.html
... / ...
CommitLineData
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6<title>
7 Module: Lyricli::Util
8
9 &mdash; Documentation by YARD 0.8.2.1
10
11</title>
12
13 <link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
14
15 <link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
16
17<script type="text/javascript" charset="utf-8">
18 hasFrames = window.top.frames.main ? true : false;
19 relpath = '../';
20 framesUrl = "../frames.html#!" + escape(window.location.href);
21</script>
22
23
24 <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
25
26 <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
27
28
29 </head>
30 <body>
31 <div id="header">
32 <div id="menu">
33
34 <a href="../_index.html">Index (U)</a> &raquo;
35 <span class='title'><span class='object_link'><a href="../Lyricli.html" title="Lyricli (module)">Lyricli</a></span></span>
36 &raquo;
37 <span class="title">Util</span>
38
39
40 <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41</div>
42
43 <div id="search">
44
45 <a class="full_list_link" id="class_list_link"
46 href="../class_list.html">
47 Class List
48 </a>
49
50 <a class="full_list_link" id="method_list_link"
51 href="../method_list.html">
52 Method List
53 </a>
54
55 <a class="full_list_link" id="file_list_link"
56 href="../file_list.html">
57 File List
58 </a>
59
60</div>
61 <div class="clear"></div>
62 </div>
63
64 <iframe id="search_frame"></iframe>
65
66 <div id="content"><h1>Module: Lyricli::Util
67
68
69
70</h1>
71
72<dl class="box">
73
74
75
76
77
78
79
80 <dt class="r1">Included in:</dt>
81 <dd class="r1"><span class='object_link'><a href="LyricsEngine.html" title="Lyricli::LyricsEngine (class)">LyricsEngine</a></span>, <span class='object_link'><a href="SourceManager.html" title="Lyricli::SourceManager (class)">SourceManager</a></span></dd>
82
83
84
85 <dt class="r2 last">Defined in:</dt>
86 <dd class="r2 last">lib/lyricli/util.rb</dd>
87
88</dl>
89<div class="clear"></div>
90
91<h2>Overview</h2><div class="docstring">
92 <div class="discussion">
93 <p>
94This module contains several utility functions.
95</p>
96
97
98 </div>
99</div>
100<div class="tags">
101
102
103</div>
104
105
106
107
108
109
110
111 <h2>
112 Instance Method Summary
113 <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
114 </h2>
115
116 <ul class="summary">
117
118 <li class="public ">
119 <span class="summary_signature">
120
121 <a href="#camelize-instance_method" title="#camelize (instance method)">- (String) <strong>camelize</strong>(str) </a>
122
123
124
125 </span>
126
127
128
129
130
131
132
133
134
135 <span class="summary_desc"><div class='inline'><p>
136Transforms a string from snake_case to UpperCamelCase.
137</p>
138</div></span>
139
140</li>
141
142
143 <li class="public ">
144 <span class="summary_signature">
145
146 <a href="#parse_class-instance_method" title="#parse_class (instance method)">- (Class<sup>?</sup>) <strong>parse_class</strong>(class_name) </a>
147
148
149
150 </span>
151
152
153
154
155
156
157
158
159
160 <span class="summary_desc"><div class='inline'><p>
161Takes a class name in snake_case and attempts to find the corresponding
162class from the sources.
163</p>
164</div></span>
165
166</li>
167
168
169 <li class="public ">
170 <span class="summary_signature">
171
172 <a href="#sanitize_param-instance_method" title="#sanitize_param (instance method)">- (String) <strong>sanitize_param</strong>(p) </a>
173
174
175
176 </span>
177
178
179
180
181
182
183
184
185
186 <span class="summary_desc"><div class='inline'><p>
187Simply escapes a param and substitutes spaces and escaped plus signs for
188plus signs.
189</p>
190</div></span>
191
192</li>
193
194
195 </ul>
196
197
198
199
200 <div id="instance_method_details" class="method_details_list">
201 <h2>Instance Method Details</h2>
202
203
204 <div class="method_details first">
205 <h3 class="signature first" id="camelize-instance_method">
206
207 - (<tt>String</tt>) <strong>camelize</strong>(str)
208
209
210
211
212
213</h3><div class="docstring">
214 <div class="discussion">
215 <p>
216Transforms a string from snake_case to UpperCamelCase
217</p>
218
219
220 </div>
221</div>
222<div class="tags">
223 <p class="tag_title">Parameters:</p>
224<ul class="param">
225
226 <li>
227
228 <span class='name'>str</span>
229
230
231 <span class='type'>(<tt>String</tt>)</span>
232
233
234
235 &mdash;
236 <div class='inline'><p>
237the string that will be Camelized
238</p>
239</div>
240
241 </li>
242
243</ul>
244
245<p class="tag_title">Returns:</p>
246<ul class="return">
247
248 <li>
249
250
251 <span class='type'>(<tt>String</tt>)</span>
252
253
254
255 &mdash;
256 <div class='inline'><p>
257the Camelized string.
258</p>
259</div>
260
261 </li>
262
263</ul>
264
265</div><table class="source_code">
266 <tr>
267 <td>
268 <pre class="lines">
269
270
2719
27210
27311</pre>
274 </td>
275 <td>
276 <pre class="code"><span class="info file"># File 'lib/lyricli/util.rb', line 9</span>
277
278<span class='kw'>def</span> <span class='id identifier rubyid_camelize'>camelize</span><span class='lparen'>(</span><span class='id identifier rubyid_str'>str</span><span class='rparen'>)</span>
279 <span class='id identifier rubyid_str'>str</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>_</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_w'>w</span><span class='op'>|</span> <span class='id identifier rubyid_w'>w</span><span class='period'>.</span><span class='id identifier rubyid_capitalize'>capitalize</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span>
280<span class='kw'>end</span></pre>
281 </td>
282 </tr>
283</table>
284</div>
285
286 <div class="method_details ">
287 <h3 class="signature " id="parse_class-instance_method">
288
289 - (<tt>Class</tt><sup>?</sup>) <strong>parse_class</strong>(class_name)
290
291
292
293
294
295</h3><div class="docstring">
296 <div class="discussion">
297 <p>
298Takes a class name in snake_case and attempts to find the corresponding
299class from the sources.
300</p>
301
302
303 </div>
304</div>
305<div class="tags">
306 <p class="tag_title">Parameters:</p>
307<ul class="param">
308
309 <li>
310
311 <span class='name'>class_name</span>
312
313
314 <span class='type'>(<tt>String</tt>)</span>
315
316
317
318 &mdash;
319 <div class='inline'><p>
320the snake_case name of the class to search for.
321</p>
322</div>
323
324 </li>
325
326</ul>
327
328<p class="tag_title">Returns:</p>
329<ul class="return">
330
331 <li>
332
333
334 <span class='type'>(<tt>Class</tt>, <tt>nil</tt>)</span>
335
336
337
338 &mdash;
339 <div class='inline'><p>
340the found class or nil
341</p>
342</div>
343
344 </li>
345
346</ul>
347
348</div><table class="source_code">
349 <tr>
350 <td>
351 <pre class="lines">
352
353
35418
35519
35620
35721
35822
35923
36024
36125</pre>
362 </td>
363 <td>
364 <pre class="code"><span class="info file"># File 'lib/lyricli/util.rb', line 18</span>
365
366<span class='kw'>def</span> <span class='id identifier rubyid_parse_class'>parse_class</span><span class='lparen'>(</span><span class='id identifier rubyid_class_name'>class_name</span><span class='rparen'>)</span>
367 <span class='kw'>begin</span>
368 <span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Sources::</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_class_name'>class_name</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
369 <span class='kw'>return</span> <span class='id identifier rubyid_eval'>eval</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
370 <span class='kw'>rescue</span> <span class='const'>NameError</span>
371 <span class='kw'>return</span> <span class='kw'>nil</span>
372 <span class='kw'>end</span>
373<span class='kw'>end</span></pre>
374 </td>
375 </tr>
376</table>
377</div>
378
379 <div class="method_details ">
380 <h3 class="signature " id="sanitize_param-instance_method">
381
382 - (<tt>String</tt>) <strong>sanitize_param</strong>(p)
383
384
385
386
387
388</h3><div class="docstring">
389 <div class="discussion">
390 <p>
391Simply escapes a param and substitutes spaces and escaped plus signs for
392plus signs.
393</p>
394
395
396 </div>
397</div>
398<div class="tags">
399 <p class="tag_title">Parameters:</p>
400<ul class="param">
401
402 <li>
403
404 <span class='name'>p</span>
405
406
407 <span class='type'>(<tt>String</tt>)</span>
408
409
410
411 &mdash;
412 <div class='inline'><p>
413the parameter to be sanitized
414</p>
415</div>
416
417 </li>
418
419</ul>
420
421<p class="tag_title">Returns:</p>
422<ul class="return">
423
424 <li>
425
426
427 <span class='type'>(<tt>String</tt>)</span>
428
429
430
431 &mdash;
432 <div class='inline'><p>
433the sanitized parameter
434</p>
435</div>
436
437 </li>
438
439</ul>
440
441</div><table class="source_code">
442 <tr>
443 <td>
444 <pre class="lines">
445
446
44732
44833
44934</pre>
450 </td>
451 <td>
452 <pre class="code"><span class="info file"># File 'lib/lyricli/util.rb', line 32</span>
453
454<span class='kw'>def</span> <span class='id identifier rubyid_sanitize_param'>sanitize_param</span><span class='lparen'>(</span><span class='id identifier rubyid_p'>p</span><span class='rparen'>)</span>
455 <span class='const'>URI</span><span class='period'>.</span><span class='id identifier rubyid_encode_www_form_component'>encode_www_form_component</span><span class='lparen'>(</span><span class='id identifier rubyid_p'>p</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'> </span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>+</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>%2B</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>+</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
456<span class='kw'>end</span></pre>
457 </td>
458 </tr>
459</table>
460</div>
461
462 </div>
463
464</div>
465
466 <div id="footer">
467 Generated on Sat Oct 6 03:20:24 2012 by
468 <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
469 0.8.2.1 (ruby-1.9.2).
470</div>
471
472 </body>
473</html>