]> git.r.bdr.sh - rbdr/lyricli.rb/blame - doc/Lyricli/Lyricli.html
Updates the readme.
[rbdr/lyricli.rb] / doc / Lyricli / Lyricli.html
CommitLineData
823e558b
BB
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
34d0bf15 9 &mdash; Documentation by YARD 0.8.2.1
823e558b
BB
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>
34d0bf15 97 <dd class="r2 last">lib/lyricli/lyricli.rb</dd>
823e558b
BB
98
99</dl>
100<div class="clear"></div>
101
f2ec7254
BB
102<h2>Overview</h2><div class="docstring">
103 <div class="discussion">
104 <p>
105This class has the basic logic for extracting the lyrics and controlling
106the application
107</p>
823e558b
BB
108
109
f2ec7254
BB
110 </div>
111</div>
112<div class="tags">
113
114
115</div>
116
823e558b
BB
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
f2ec7254
BB
147 <span class="summary_desc"><div class='inline'><p>
148Exits with error when there is an empty field from the current track.
149</p>
150</div></span>
823e558b
BB
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
f2ec7254 172 <span class="summary_desc"><div class='inline'><p>
278e6d0a 173Raises an InvalidLyricsError which means we did not get any valid
f2ec7254
BB
174artist/song from any of the sources.
175</p>
176</div></span>
823e558b
BB
177
178</li>
179
180
181 <li class="public ">
182 <span class="summary_signature">
183
f2ec7254 184 <a href="#get_lyrics-instance_method" title="#get_lyrics (instance method)">- (String) <strong>get_lyrics</strong> </a>
823e558b
BB
185
186
187
188 </span>
189
190
191
192
193
194
195
196
197
f2ec7254
BB
198 <span class="summary_desc"><div class='inline'><p>
199Extracts the current track, validates it and requests the lyrics from our
200LyricsEngine.
201</p>
202</div></span>
823e558b
BB
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>
f2ec7254 227Constructor, initializes `@source_manager`.
823e558b
BB
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
f2ec7254
BB
251 <span class="summary_desc"><div class='inline'><p>
252Set the `@current_track` instance variable by asking the SourceManager for
253its current track.
254</p>
255</div></span>
823e558b
BB
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>
f2ec7254 278Constructor, initializes `@source_manager`
823e558b
BB
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
f2ec7254
BB
2938
2949
29510</pre>
823e558b
BB
296 </td>
297 <td>
f2ec7254 298 <pre class="code"><span class="info file"># File 'lib/lyricli/lyricli.rb', line 8</span>
823e558b
BB
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
f2ec7254
BB
324</h3><div class="docstring">
325 <div class="discussion">
326 <p>
327Exits 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">
823e558b
BB
337 <tr>
338 <td>
339 <pre class="lines">
340
341
278e6d0a
BB
34249
34350
34451
34552
34653</pre>
823e558b
BB
347 </td>
348 <td>
278e6d0a 349 <pre class="code"><span class="info file"># File 'lib/lyricli/lyricli.rb', line 49</span>
823e558b
BB
350
351<span class='kw'>def</span> <span class='id identifier rubyid_check_params'>check_params</span>
278e6d0a 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'>unless</span> <span class='ivar'>@current_track</span>
823e558b
BB
353 <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>
354 <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>
355<span class='kw'>end</span></pre>
356 </td>
357 </tr>
358</table>
359</div>
360
361 <div class="method_details ">
362 <h3 class="signature " id="exit_with_error-instance_method">
363
364 - (<tt>Object</tt>) <strong>exit_with_error</strong>
365
366
367
368
369
34d0bf15
BB
370</h3><div class="docstring">
371 <div class="discussion">
f2ec7254 372 <p>
278e6d0a 373Raises an InvalidLyricsError which means we did not get any valid
f2ec7254
BB
374artist/song from any of the sources
375</p>
376
34d0bf15
BB
377
378 </div>
379</div>
380<div class="tags">
381
382<p class="tag_title">Raises:</p>
383<ul class="raise">
384
385 <li>
386
387
278e6d0a 388 <span class='type'>(<tt><span class='object_link'><a href="Exceptions/InvalidLyricsError.html" title="Lyricli::Exceptions::InvalidLyricsError (class)">Lyricli::Exceptions::InvalidLyricsError</a></span></tt>)</span>
f2ec7254 389
34d0bf15
BB
390
391
f2ec7254
BB
392 &mdash;
393 <div class='inline'><p>
394because we found nothing
395</p>
396</div>
34d0bf15
BB
397
398 </li>
399
400</ul>
401
402</div><table class="source_code">
823e558b
BB
403 <tr>
404 <td>
405 <pre class="lines">
406
407
f2ec7254
BB
40816
40917
41018</pre>
823e558b
BB
411 </td>
412 <td>
f2ec7254 413 <pre class="code"><span class="info file"># File 'lib/lyricli/lyricli.rb', line 16</span>
823e558b
BB
414
415<span class='kw'>def</span> <span class='id identifier rubyid_exit_with_error'>exit_with_error</span>
278e6d0a 416 <span class='id identifier rubyid_raise'>raise</span> <span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>InvalidLyricsError</span>
823e558b
BB
417<span class='kw'>end</span></pre>
418 </td>
419 </tr>
420</table>
421</div>
422
423 <div class="method_details ">
424 <h3 class="signature " id="get_lyrics-instance_method">
425
f2ec7254 426 - (<tt>String</tt>) <strong>get_lyrics</strong>
823e558b
BB
427
428
429
430
431
f2ec7254
BB
432</h3><div class="docstring">
433 <div class="discussion">
434 <p>
435Extracts the current track, validates it and requests the lyrics from our
436LyricsEngine
437</p>
438
439
440 </div>
441</div>
442<div class="tags">
443
444<p class="tag_title">Returns:</p>
445<ul class="return">
446
447 <li>
448
449
450 <span class='type'>(<tt>String</tt>)</span>
451
452
453
454 &mdash;
455 <div class='inline'><p>
456the found lyrics, or a string indicating none were found
457</p>
458</div>
459
460 </li>
461
462</ul>
463
464</div><table class="source_code">
823e558b
BB
465 <tr>
466 <td>
467 <pre class="lines">
468
469
f2ec7254
BB
47024
47125
47226
47327
47428
47529
47630
47731
47832
47933
48034
278e6d0a
BB
48135
48236
48337
48438
48539
48640</pre>
823e558b
BB
487 </td>
488 <td>
f2ec7254 489 <pre class="code"><span class="info file"># File 'lib/lyricli/lyricli.rb', line 24</span>
823e558b
BB
490
491<span class='kw'>def</span> <span class='id identifier rubyid_get_lyrics'>get_lyrics</span>
278e6d0a
BB
492
493 <span class='kw'>begin</span>
494 <span class='id identifier rubyid_set_current_track'>set_current_track</span>
495 <span class='id identifier rubyid_check_params'>check_params</span>
496 <span class='kw'>rescue</span> <span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>InvalidLyricsError</span>
497 <span class='kw'>return</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>No Artist/Song could be found :(</span><span class='tstring_end'>&quot;</span></span>
498 <span class='kw'>end</span>
823e558b
BB
499
500 <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>
501
502 <span class='kw'>begin</span>
278e6d0a
BB
503 <span class='kw'>return</span> <span class='id identifier rubyid_engine'>engine</span><span class='period'>.</span><span class='id identifier rubyid_get_lyrics'>get_lyrics</span>
504 <span class='kw'>rescue</span> <span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>LyricsNotFoundError</span>
505 <span class='kw'>return</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Lyrics not found :(</span><span class='tstring_end'>&quot;</span></span>
823e558b
BB
506 <span class='kw'>end</span>
507<span class='kw'>end</span></pre>
508 </td>
509 </tr>
510</table>
511</div>
512
513 <div class="method_details ">
514 <h3 class="signature " id="set_current_track-instance_method">
515
516 - (<tt>Object</tt>) <strong>set_current_track</strong>
517
518
519
520
521
f2ec7254
BB
522</h3><div class="docstring">
523 <div class="discussion">
524 <p>
525Set the `@current_track` instance variable by asking the SourceManager for
526its current track
527</p>
528
529
530 </div>
531</div>
532<div class="tags">
533
534
535</div><table class="source_code">
823e558b
BB
536 <tr>
537 <td>
538 <pre class="lines">
539
540
278e6d0a
BB
54144
54245
54346</pre>
823e558b
BB
544 </td>
545 <td>
278e6d0a 546 <pre class="code"><span class="info file"># File 'lib/lyricli/lyricli.rb', line 44</span>
823e558b
BB
547
548<span class='kw'>def</span> <span class='id identifier rubyid_set_current_track'>set_current_track</span>
549 <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>
550<span class='kw'>end</span></pre>
551 </td>
552 </tr>
553</table>
554</div>
555
556 </div>
557
558</div>
559
560 <div id="footer">
278e6d0a 561 Generated on Sat Oct 6 03:20:24 2012 by
823e558b 562 <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
34d0bf15 563 0.8.2.1 (ruby-1.9.2).
823e558b
BB
564</div>
565
566 </body>
567</html>