]> git.r.bdr.sh - rbdr/lyricli.rb/blob - doc/Lyricli/Lyricli.html
60c3a9487d2b5bbc02a5124a4af60647b104ae42
[rbdr/lyricli.rb] / doc / Lyricli / Lyricli.html
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 Class: Lyricli::Lyricli
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 (L)</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">Lyricli</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>Class: Lyricli::Lyricli
67
68
69
70 </h1>
71
72 <dl class="box">
73
74 <dt class="r1">Inherits:</dt>
75 <dd class="r1">
76 <span class="inheritName">Object</span>
77
78 <ul class="fullTree">
79 <li>Object</li>
80
81 <li class="next">Lyricli::Lyricli</li>
82
83 </ul>
84 <a href="#" class="inheritanceTree">show all</a>
85
86 </dd>
87
88
89
90
91
92
93
94
95
96 <dt class="r2 last">Defined in:</dt>
97 <dd class="r2 last">lib/lyricli/lyricli.rb</dd>
98
99 </dl>
100 <div class="clear"></div>
101
102 <h2>Overview</h2><div class="docstring">
103 <div class="discussion">
104 <p>
105 This class has the basic logic for extracting the lyrics and controlling
106 the application
107 </p>
108
109
110 </div>
111 </div>
112 <div class="tags">
113
114
115 </div>
116
117
118
119
120
121
122
123 <h2>
124 Instance Method Summary
125 <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
126 </h2>
127
128 <ul class="summary">
129
130 <li class="public ">
131 <span class="summary_signature">
132
133 <a href="#check_params-instance_method" title="#check_params (instance method)">- (Object) <strong>check_params</strong> </a>
134
135
136
137 </span>
138
139
140
141
142
143
144
145
146
147 <span class="summary_desc"><div class='inline'><p>
148 Exits with error when there is an empty field from the current track.
149 </p>
150 </div></span>
151
152 </li>
153
154
155 <li class="public ">
156 <span class="summary_signature">
157
158 <a href="#exit_with_error-instance_method" title="#exit_with_error (instance method)">- (Object) <strong>exit_with_error</strong> </a>
159
160
161
162 </span>
163
164
165
166
167
168
169
170
171
172 <span class="summary_desc"><div class='inline'><p>
173 Raises an InvalidLyricsException which means we did not get any valid
174 artist/song from any of the sources.
175 </p>
176 </div></span>
177
178 </li>
179
180
181 <li class="public ">
182 <span class="summary_signature">
183
184 <a href="#get_lyrics-instance_method" title="#get_lyrics (instance method)">- (String) <strong>get_lyrics</strong> </a>
185
186
187
188 </span>
189
190
191
192
193
194
195
196
197
198 <span class="summary_desc"><div class='inline'><p>
199 Extracts the current track, validates it and requests the lyrics from our
200 LyricsEngine.
201 </p>
202 </div></span>
203
204 </li>
205
206
207 <li class="public ">
208 <span class="summary_signature">
209
210 <a href="#initialize-instance_method" title="#initialize (instance method)">- (Lyricli) <strong>initialize</strong> </a>
211
212
213
214 </span>
215
216
217 <span class="note title constructor">constructor</span>
218
219
220
221
222
223
224
225
226 <span class="summary_desc"><div class='inline'><p>
227 Constructor, initializes `@source_manager`.
228 </p>
229 </div></span>
230
231 </li>
232
233
234 <li class="public ">
235 <span class="summary_signature">
236
237 <a href="#set_current_track-instance_method" title="#set_current_track (instance method)">- (Object) <strong>set_current_track</strong> </a>
238
239
240
241 </span>
242
243
244
245
246
247
248
249
250
251 <span class="summary_desc"><div class='inline'><p>
252 Set the `@current_track` instance variable by asking the SourceManager for
253 its current track.
254 </p>
255 </div></span>
256
257 </li>
258
259
260 </ul>
261
262
263 <div id="constructor_details" class="method_details_list">
264 <h2>Constructor Details</h2>
265
266 <div class="method_details first">
267 <h3 class="signature first" id="initialize-instance_method">
268
269 - (<tt><span class='object_link'><a href="" title="Lyricli::Lyricli (class)">Lyricli</a></span></tt>) <strong>initialize</strong>
270
271
272
273
274
275 </h3><div class="docstring">
276 <div class="discussion">
277 <p>
278 Constructor, initializes `@source_manager`
279 </p>
280
281
282 </div>
283 </div>
284 <div class="tags">
285
286
287 </div><table class="source_code">
288 <tr>
289 <td>
290 <pre class="lines">
291
292
293 8
294 9
295 10</pre>
296 </td>
297 <td>
298 <pre class="code"><span class="info file"># File 'lib/lyricli/lyricli.rb', line 8</span>
299
300 <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
301 <span class='ivar'>@source_manager</span> <span class='op'>=</span> <span class='const'>SourceManager</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
302 <span class='kw'>end</span></pre>
303 </td>
304 </tr>
305 </table>
306 </div>
307
308 </div>
309
310
311 <div id="instance_method_details" class="method_details_list">
312 <h2>Instance Method Details</h2>
313
314
315 <div class="method_details first">
316 <h3 class="signature first" id="check_params-instance_method">
317
318 - (<tt>Object</tt>) <strong>check_params</strong>
319
320
321
322
323
324 </h3><div class="docstring">
325 <div class="discussion">
326 <p>
327 Exits with error when there is an empty field from the current track.
328 </p>
329
330
331 </div>
332 </div>
333 <div class="tags">
334
335
336 </div><table class="source_code">
337 <tr>
338 <td>
339 <pre class="lines">
340
341
342 44
343 45
344 46
345 47</pre>
346 </td>
347 <td>
348 <pre class="code"><span class="info file"># File 'lib/lyricli/lyricli.rb', line 44</span>
349
350 <span class='kw'>def</span> <span class='id identifier rubyid_check_params'>check_params</span>
351 <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_exit_with_error'>exit_with_error</span> <span class='kw'>if</span> <span class='ivar'>@current_track</span><span class='lbracket'>[</span><span class='symbol'>:artist</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='kw'>or</span> <span class='ivar'>@current_track</span><span class='lbracket'>[</span><span class='symbol'>:artist</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
352 <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_exit_with_error'>exit_with_error</span> <span class='kw'>if</span> <span class='ivar'>@current_track</span><span class='lbracket'>[</span><span class='symbol'>:song</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='kw'>or</span> <span class='ivar'>@current_track</span><span class='lbracket'>[</span><span class='symbol'>:song</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
353 <span class='kw'>end</span></pre>
354 </td>
355 </tr>
356 </table>
357 </div>
358
359 <div class="method_details ">
360 <h3 class="signature " id="exit_with_error-instance_method">
361
362 - (<tt>Object</tt>) <strong>exit_with_error</strong>
363
364
365
366
367
368 </h3><div class="docstring">
369 <div class="discussion">
370 <p>
371 Raises an InvalidLyricsException which means we did not get any valid
372 artist/song from any of the sources
373 </p>
374
375
376 </div>
377 </div>
378 <div class="tags">
379
380 <p class="tag_title">Raises:</p>
381 <ul class="raise">
382
383 <li>
384
385
386 <span class='type'>(<tt>Lyricli::InvalidLyricsException</tt>)</span>
387
388
389
390 &mdash;
391 <div class='inline'><p>
392 because we found nothing
393 </p>
394 </div>
395
396 </li>
397
398 </ul>
399
400 </div><table class="source_code">
401 <tr>
402 <td>
403 <pre class="lines">
404
405
406 16
407 17
408 18</pre>
409 </td>
410 <td>
411 <pre class="code"><span class="info file"># File 'lib/lyricli/lyricli.rb', line 16</span>
412
413 <span class='kw'>def</span> <span class='id identifier rubyid_exit_with_error'>exit_with_error</span>
414 <span class='id identifier rubyid_raise'>raise</span> <span class='const'>InvalidLyricsException</span>
415 <span class='kw'>end</span></pre>
416 </td>
417 </tr>
418 </table>
419 </div>
420
421 <div class="method_details ">
422 <h3 class="signature " id="get_lyrics-instance_method">
423
424 - (<tt>String</tt>) <strong>get_lyrics</strong>
425
426
427
428
429
430 </h3><div class="docstring">
431 <div class="discussion">
432 <p>
433 Extracts the current track, validates it and requests the lyrics from our
434 LyricsEngine
435 </p>
436
437
438 </div>
439 </div>
440 <div class="tags">
441
442 <p class="tag_title">Returns:</p>
443 <ul class="return">
444
445 <li>
446
447
448 <span class='type'>(<tt>String</tt>)</span>
449
450
451
452 &mdash;
453 <div class='inline'><p>
454 the found lyrics, or a string indicating none were found
455 </p>
456 </div>
457
458 </li>
459
460 </ul>
461
462 </div><table class="source_code">
463 <tr>
464 <td>
465 <pre class="lines">
466
467
468 24
469 25
470 26
471 27
472 28
473 29
474 30
475 31
476 32
477 33
478 34
479 35</pre>
480 </td>
481 <td>
482 <pre class="code"><span class="info file"># File 'lib/lyricli/lyricli.rb', line 24</span>
483
484 <span class='kw'>def</span> <span class='id identifier rubyid_get_lyrics'>get_lyrics</span>
485 <span class='id identifier rubyid_set_current_track'>set_current_track</span>
486 <span class='id identifier rubyid_check_params'>check_params</span>
487
488 <span class='id identifier rubyid_engine'>engine</span> <span class='op'>=</span> <span class='const'>LyricsEngine</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='ivar'>@current_track</span><span class='lbracket'>[</span><span class='symbol'>:artist</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='ivar'>@current_track</span><span class='lbracket'>[</span><span class='symbol'>:song</span><span class='rbracket'>]</span><span class='rparen'>)</span>
489
490 <span class='kw'>begin</span>
491 <span class='id identifier rubyid_engine'>engine</span><span class='period'>.</span><span class='id identifier rubyid_get_lyrics'>get_lyrics</span>
492 <span class='kw'>rescue</span> <span class='const'>LyricsNotFoundException</span>
493 <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Lyrics not found :(</span><span class='tstring_end'>&quot;</span></span>
494 <span class='kw'>end</span>
495 <span class='kw'>end</span></pre>
496 </td>
497 </tr>
498 </table>
499 </div>
500
501 <div class="method_details ">
502 <h3 class="signature " id="set_current_track-instance_method">
503
504 - (<tt>Object</tt>) <strong>set_current_track</strong>
505
506
507
508
509
510 </h3><div class="docstring">
511 <div class="discussion">
512 <p>
513 Set the `@current_track` instance variable by asking the SourceManager for
514 its current track
515 </p>
516
517
518 </div>
519 </div>
520 <div class="tags">
521
522
523 </div><table class="source_code">
524 <tr>
525 <td>
526 <pre class="lines">
527
528
529 39
530 40
531 41</pre>
532 </td>
533 <td>
534 <pre class="code"><span class="info file"># File 'lib/lyricli/lyricli.rb', line 39</span>
535
536 <span class='kw'>def</span> <span class='id identifier rubyid_set_current_track'>set_current_track</span>
537 <span class='ivar'>@current_track</span> <span class='op'>=</span> <span class='ivar'>@source_manager</span><span class='period'>.</span><span class='id identifier rubyid_current_track'>current_track</span>
538 <span class='kw'>end</span></pre>
539 </td>
540 </tr>
541 </table>
542 </div>
543
544 </div>
545
546 </div>
547
548 <div id="footer">
549 Generated on Sat Oct 6 02:34:27 2012 by
550 <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
551 0.8.2.1 (ruby-1.9.2).
552 </div>
553
554 </body>
555 </html>