]>
Commit | Line | Data |
---|---|---|
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::SourceManager | |
8 | ||
34d0bf15 | 9 | — 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 (S)</a> » | |
35 | <span class='title'><span class='object_link'><a href="../Lyricli.html" title="Lyricli (module)">Lyricli</a></span></span> | |
36 | » | |
37 | <span class="title">SourceManager</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::SourceManager | |
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::SourceManager</li> | |
82 | ||
83 | </ul> | |
84 | <a href="#" class="inheritanceTree">show all</a> | |
85 | ||
86 | </dd> | |
87 | ||
88 | ||
89 | ||
90 | ||
91 | ||
92 | ||
93 | <dt class="r2">Includes:</dt> | |
94 | <dd class="r2"><span class='object_link'><a href="Util.html" title="Lyricli::Util (module)">Util</a></span></dd> | |
95 | ||
96 | ||
97 | ||
98 | ||
99 | ||
100 | <dt class="r1 last">Defined in:</dt> | |
101 | <dd class="r1 last">lib/lyricli/source_manager.rb</dd> | |
102 | ||
103 | </dl> | |
104 | <div class="clear"></div> | |
105 | ||
106 | ||
107 | ||
108 | ||
109 | ||
110 | ||
111 | ||
112 | ||
113 | ||
114 | <h2> | |
115 | Instance Method Summary | |
116 | <small>(<a href="#" class="summary_toggle">collapse</a>)</small> | |
117 | </h2> | |
118 | ||
119 | <ul class="summary"> | |
120 | ||
121 | <li class="public "> | |
122 | <span class="summary_signature"> | |
123 | ||
34d0bf15 BB |
124 | <a href="#available_sources-instance_method" title="#available_sources (instance method)">- (Object) <strong>available_sources</strong>(format = false) </a> |
125 | ||
126 | ||
127 | ||
128 | </span> | |
129 | ||
130 | ||
131 | ||
132 | ||
133 | ||
134 | ||
135 | ||
136 | ||
137 | ||
138 | <span class="summary_desc"><div class='inline'></div></span> | |
139 | ||
140 | </li> | |
141 | ||
142 | ||
143 | <li class="public "> | |
144 | <span class="summary_signature"> | |
145 | ||
823e558b BB |
146 | <a href="#current_track-instance_method" title="#current_track (instance method)">- (Object) <strong>current_track</strong> </a> |
147 | ||
148 | ||
149 | ||
150 | </span> | |
151 | ||
152 | ||
153 | ||
154 | ||
155 | ||
156 | ||
157 | ||
158 | ||
159 | ||
160 | <span class="summary_desc"><div class='inline'></div></span> | |
161 | ||
162 | </li> | |
163 | ||
164 | ||
165 | <li class="public "> | |
166 | <span class="summary_signature"> | |
167 | ||
168 | <a href="#disable-instance_method" title="#disable (instance method)">- (Object) <strong>disable</strong>(source_name) </a> | |
169 | ||
170 | ||
171 | ||
172 | </span> | |
173 | ||
174 | ||
175 | ||
176 | ||
177 | ||
178 | ||
179 | ||
180 | ||
181 | ||
182 | <span class="summary_desc"><div class='inline'></div></span> | |
183 | ||
184 | </li> | |
185 | ||
186 | ||
187 | <li class="public "> | |
188 | <span class="summary_signature"> | |
189 | ||
190 | <a href="#enable-instance_method" title="#enable (instance method)">- (Object) <strong>enable</strong>(source_name) </a> | |
191 | ||
192 | ||
193 | ||
194 | </span> | |
195 | ||
196 | ||
197 | ||
198 | ||
199 | ||
200 | ||
201 | ||
202 | ||
203 | ||
34d0bf15 BB |
204 | <span class="summary_desc"><div class='inline'></div></span> |
205 | ||
206 | </li> | |
207 | ||
208 | ||
209 | <li class="public "> | |
210 | <span class="summary_signature"> | |
211 | ||
212 | <a href="#format_sources-instance_method" title="#format_sources (instance method)">- (Object) <strong>format_sources</strong>(sources) </a> | |
213 | ||
214 | ||
215 | ||
216 | </span> | |
217 | ||
218 | ||
219 | ||
220 | ||
221 | ||
222 | ||
223 | ||
224 | ||
225 | ||
823e558b BB |
226 | <span class="summary_desc"><div class='inline'></div></span> |
227 | ||
228 | </li> | |
229 | ||
230 | ||
231 | <li class="public "> | |
232 | <span class="summary_signature"> | |
233 | ||
234 | <a href="#initialize-instance_method" title="#initialize (instance method)">- (SourceManager) <strong>initialize</strong> </a> | |
235 | ||
236 | ||
237 | ||
238 | </span> | |
239 | ||
240 | ||
241 | <span class="note title constructor">constructor</span> | |
242 | ||
243 | ||
244 | ||
245 | ||
246 | ||
247 | ||
248 | ||
249 | ||
250 | <span class="summary_desc"><div class='inline'><p> | |
251 | A new instance of SourceManager. | |
252 | </p> | |
253 | </div></span> | |
254 | ||
255 | </li> | |
256 | ||
257 | ||
258 | <li class="public "> | |
259 | <span class="summary_signature"> | |
260 | ||
261 | <a href="#reset-instance_method" title="#reset (instance method)">- (Object) <strong>reset</strong>(source_name) </a> | |
262 | ||
263 | ||
264 | ||
265 | </span> | |
266 | ||
267 | ||
268 | ||
269 | ||
270 | ||
271 | ||
272 | ||
273 | ||
274 | ||
275 | <span class="summary_desc"><div class='inline'></div></span> | |
276 | ||
277 | </li> | |
278 | ||
279 | ||
280 | </ul> | |
281 | ||
282 | ||
283 | ||
284 | ||
285 | ||
286 | ||
287 | ||
288 | ||
289 | ||
290 | ||
291 | ||
292 | <h3 class="inherited">Methods included from <span class='object_link'><a href="Util.html" title="Lyricli::Util (module)">Util</a></span></h3> | |
293 | <p class="inherited"><span class='object_link'><a href="Util.html#camelize-instance_method" title="Lyricli::Util#camelize (method)">#camelize</a></span>, <span class='object_link'><a href="Util.html#parse_class-instance_method" title="Lyricli::Util#parse_class (method)">#parse_class</a></span>, <span class='object_link'><a href="Util.html#sanitize_param-instance_method" title="Lyricli::Util#sanitize_param (method)">#sanitize_param</a></span></p> | |
294 | <div id="constructor_details" class="method_details_list"> | |
295 | <h2>Constructor Details</h2> | |
296 | ||
297 | <div class="method_details first"> | |
298 | <h3 class="signature first" id="initialize-instance_method"> | |
299 | ||
300 | - (<tt><span class='object_link'><a href="" title="Lyricli::SourceManager (class)">SourceManager</a></span></tt>) <strong>initialize</strong> | |
301 | ||
302 | ||
303 | ||
304 | ||
305 | ||
306 | </h3><div class="docstring"> | |
307 | <div class="discussion"> | |
308 | <p> | |
309 | A new instance of SourceManager | |
310 | </p> | |
311 | ||
312 | ||
313 | </div> | |
314 | </div> | |
315 | <div class="tags"> | |
316 | ||
317 | ||
318 | </div><table class="source_code"> | |
319 | <tr> | |
320 | <td> | |
321 | <pre class="lines"> | |
322 | ||
323 | ||
324 | 6 | |
325 | 7 | |
326 | 8 | |
327 | 9 | |
328 | 10 | |
329 | 11 | |
330 | 12 | |
331 | 13 | |
332 | 14 | |
333 | 15 | |
334 | 16 | |
335 | 17</pre> | |
336 | </td> | |
337 | <td> | |
338 | <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 6</span> | |
339 | ||
340 | <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span> | |
341 | <span class='ivar'>@enabled_sources</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span> | |
342 | <span class='ivar'>@config</span> <span class='op'>=</span> <span class='const'>Configuration</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span> | |
343 | <span class='ivar'>@config</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>enabled_sources</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_source'>source</span><span class='op'>|</span> | |
344 | <span class='kw'>if</span> <span class='id identifier rubyid_klass'>klass</span> <span class='op'>=</span> <span class='id identifier rubyid_parse_class'>parse_class</span><span class='lparen'>(</span><span class='id identifier rubyid_camelize'>camelize</span><span class='lparen'>(</span><span class='id identifier rubyid_source'>source</span><span class='rparen'>)</span><span class='rparen'>)</span> | |
345 | <span class='id identifier rubyid_current_source'>current_source</span> <span class='op'>=</span> <span class='id identifier rubyid_klass'>klass</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> | |
346 | <span class='ivar'>@enabled_sources</span> <span class='op'><<</span> <span class='id identifier rubyid_current_source'>current_source</span> | |
347 | <span class='kw'>else</span> | |
348 | <span class='id identifier rubyid_raise'>raise</span> <span class='const'>StartSourceException</span> | |
349 | <span class='kw'>end</span> | |
350 | <span class='kw'>end</span> | |
351 | <span class='kw'>end</span></pre> | |
352 | </td> | |
353 | </tr> | |
354 | </table> | |
355 | </div> | |
356 | ||
357 | </div> | |
358 | ||
359 | ||
360 | <div id="instance_method_details" class="method_details_list"> | |
361 | <h2>Instance Method Details</h2> | |
362 | ||
363 | ||
364 | <div class="method_details first"> | |
34d0bf15 BB |
365 | <h3 class="signature first" id="available_sources-instance_method"> |
366 | ||
367 | - (<tt>Object</tt>) <strong>available_sources</strong>(format = false) | |
368 | ||
369 | ||
370 | ||
371 | ||
372 | ||
373 | </h3><table class="source_code"> | |
374 | <tr> | |
375 | <td> | |
376 | <pre class="lines"> | |
377 | ||
378 | ||
379 | 81 | |
380 | 82 | |
381 | 83 | |
382 | 84 | |
383 | 85 | |
384 | 86 | |
385 | 87 | |
386 | 88 | |
387 | 89 | |
388 | 90 | |
389 | 91 | |
390 | 92 | |
391 | 93 | |
392 | 94 | |
393 | 95 | |
394 | 96 | |
395 | 97</pre> | |
396 | </td> | |
397 | <td> | |
398 | <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 81</span> | |
399 | ||
400 | <span class='kw'>def</span> <span class='id identifier rubyid_available_sources'>available_sources</span><span class='lparen'>(</span><span class='id identifier rubyid_format'>format</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span> | |
401 | <span class='id identifier rubyid_path_root'>path_root</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span> | |
402 | <span class='id identifier rubyid_sources'>sources</span> <span class='op'>=</span> <span class='const'>Dir</span><span class='lbracket'>[</span><span class='id identifier rubyid_path_root'>path_root</span><span class='op'>+</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/sources/*.rb</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</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_s'>s</span><span class='op'>|</span> | |
403 | <span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='id identifier rubyid_s'>s</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_last'>last</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'>\.rb</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> | |
404 | ||
405 | <span class='comment'># Add a star to denote enabled sources | |
406 | </span> <span class='id identifier rubyid_name'>name</span> | |
407 | <span class='rbrace'>}</span> | |
408 | ||
409 | <span class='comment'># Remove arguments (Hack?) We don't want anybody to touch tihs one. | |
410 | </span> <span class='id identifier rubyid_sources'>sources</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>arguments</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> | |
411 | <span class='kw'>if</span> <span class='id identifier rubyid_format'>format</span> | |
412 | <span class='id identifier rubyid_format_sources'>format_sources</span><span class='lparen'>(</span><span class='id identifier rubyid_sources'>sources</span><span class='rparen'>)</span> | |
413 | <span class='kw'>else</span> | |
414 | <span class='id identifier rubyid_sources'>sources</span> | |
415 | <span class='kw'>end</span> | |
416 | <span class='kw'>end</span></pre> | |
417 | </td> | |
418 | </tr> | |
419 | </table> | |
420 | </div> | |
421 | ||
422 | <div class="method_details "> | |
423 | <h3 class="signature " id="current_track-instance_method"> | |
823e558b BB |
424 | |
425 | - (<tt>Object</tt>) <strong>current_track</strong> | |
426 | ||
427 | ||
428 | ||
429 | ||
430 | ||
431 | </h3><table class="source_code"> | |
432 | <tr> | |
433 | <td> | |
434 | <pre class="lines"> | |
435 | ||
436 | ||
34d0bf15 BB |
437 | 60 |
438 | 61 | |
439 | 62 | |
440 | 63 | |
441 | 64 | |
442 | 65 | |
443 | 66 | |
444 | 67 | |
445 | 68 | |
446 | 69 | |
447 | 70 | |
448 | 71 | |
449 | 72 | |
450 | 73 | |
451 | 74 | |
452 | 75 | |
453 | 76 | |
454 | 77 | |
455 | 78 | |
456 | 79</pre> | |
823e558b BB |
457 | </td> |
458 | <td> | |
34d0bf15 | 459 | <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 60</span> |
823e558b BB |
460 | |
461 | <span class='kw'>def</span> <span class='id identifier rubyid_current_track'>current_track</span> | |
462 | <span class='id identifier rubyid_track'>track</span> <span class='op'>=</span> <span class='kw'>nil</span> | |
34d0bf15 | 463 | <span class='id identifier rubyid_lock'>lock</span> <span class='op'>=</span> <span class='kw'>false</span> |
823e558b BB |
464 | <span class='ivar'>@enabled_sources</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_source'>source</span><span class='op'>|</span> |
465 | <span class='kw'>begin</span> | |
34d0bf15 BB |
466 | <span class='id identifier rubyid_current_track'>current_track</span> <span class='op'>=</span> <span class='id identifier rubyid_source'>source</span><span class='period'>.</span><span class='id identifier rubyid_current_track'>current_track</span> |
467 | ||
468 | <span class='comment'># This is a special thing for arguments. The thing is, they need to | |
469 | </span> <span class='comment'># be inputted manually. So, if they are present they won't allow | |
470 | </span> <span class='comment'># anyone else to give results. Makes sense, yet a bit hacky. | |
471 | </span> <span class='kw'>unless</span> <span class='id identifier rubyid_current_track'>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='op'>||</span> <span class='id identifier rubyid_current_track'>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> <span class='op'>||</span> <span class='id identifier rubyid_current_track'>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='op'>||</span> <span class='id identifier rubyid_current_track'>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> | |
472 | <span class='id identifier rubyid_track'>track</span> <span class='op'>=</span> <span class='id identifier rubyid_current_track'>current_track</span> <span class='kw'>unless</span> <span class='id identifier rubyid_lock'>lock</span> | |
473 | <span class='id identifier rubyid_lock'>lock</span> <span class='op'>=</span> <span class='kw'>true</span> <span class='kw'>if</span> <span class='id identifier rubyid_source'>source</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>arguments</span><span class='tstring_end'>"</span></span> | |
474 | <span class='kw'>end</span> | |
823e558b | 475 | <span class='kw'>rescue</span> |
34d0bf15 | 476 | <span class='id identifier rubyid_raise'>raise</span> <span class='const'>SourceConfigurationException</span> |
823e558b BB |
477 | <span class='kw'>end</span> |
478 | <span class='kw'>end</span> | |
479 | <span class='id identifier rubyid_track'>track</span> | |
480 | <span class='kw'>end</span></pre> | |
481 | </td> | |
482 | </tr> | |
483 | </table> | |
484 | </div> | |
485 | ||
486 | <div class="method_details "> | |
487 | <h3 class="signature " id="disable-instance_method"> | |
488 | ||
489 | - (<tt>Object</tt>) <strong>disable</strong>(source_name) | |
490 | ||
491 | ||
492 | ||
493 | ||
494 | ||
495 | </h3><table class="source_code"> | |
496 | <tr> | |
497 | <td> | |
498 | <pre class="lines"> | |
499 | ||
500 | ||
823e558b | 501 | 34 |
34d0bf15 BB |
502 | 35 |
503 | 36 | |
504 | 37 | |
505 | 38 | |
506 | 39 | |
507 | 40 | |
508 | 41 | |
509 | 42 | |
510 | 43 | |
511 | 44 | |
512 | 45</pre> | |
823e558b BB |
513 | </td> |
514 | <td> | |
34d0bf15 | 515 | <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 34</span> |
823e558b BB |
516 | |
517 | <span class='kw'>def</span> <span class='id identifier rubyid_disable'>disable</span><span class='lparen'>(</span><span class='id identifier rubyid_source_name'>source_name</span><span class='rparen'>)</span> | |
34d0bf15 BB |
518 | <span class='kw'>if</span> <span class='id identifier rubyid_available_sources'>available_sources</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_source_name'>source_name</span><span class='rparen'>)</span> |
519 | <span class='kw'>if</span> <span class='id identifier rubyid_klass'>klass</span> <span class='op'>=</span> <span class='id identifier rubyid_parse_class'>parse_class</span><span class='lparen'>(</span><span class='id identifier rubyid_camelize'>camelize</span><span class='lparen'>(</span><span class='id identifier rubyid_source_name'>source_name</span><span class='rparen'>)</span><span class='rparen'>)</span> | |
520 | <span class='ivar'>@config</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>enabled_sources</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_klass'>klass</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span> | |
521 | <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_save_config'>save_config</span> | |
522 | <span class='kw'>else</span> | |
523 | <span class='id identifier rubyid_raise'>raise</span> <span class='const'>DisableSourceException</span> | |
524 | <span class='kw'>end</span> | |
823e558b | 525 | <span class='kw'>else</span> |
34d0bf15 | 526 | <span class='id identifier rubyid_raise'>raise</span> <span class='const'>UnknownSource</span> |
823e558b BB |
527 | <span class='kw'>end</span> |
528 | <span class='kw'>end</span></pre> | |
529 | </td> | |
530 | </tr> | |
531 | </table> | |
532 | </div> | |
533 | ||
534 | <div class="method_details "> | |
535 | <h3 class="signature " id="enable-instance_method"> | |
536 | ||
537 | - (<tt>Object</tt>) <strong>enable</strong>(source_name) | |
538 | ||
539 | ||
540 | ||
541 | ||
542 | ||
543 | </h3><table class="source_code"> | |
544 | <tr> | |
545 | <td> | |
546 | <pre class="lines"> | |
547 | ||
548 | ||
549 | 19 | |
550 | 20 | |
551 | 21 | |
552 | 22 | |
553 | 23 | |
554 | 24 | |
555 | 25 | |
556 | 26 | |
34d0bf15 BB |
557 | 27 |
558 | 28 | |
559 | 29 | |
560 | 30 | |
561 | 31 | |
562 | 32</pre> | |
823e558b BB |
563 | </td> |
564 | <td> | |
565 | <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 19</span> | |
566 | ||
567 | <span class='kw'>def</span> <span class='id identifier rubyid_enable'>enable</span><span class='lparen'>(</span><span class='id identifier rubyid_source_name'>source_name</span><span class='rparen'>)</span> | |
34d0bf15 BB |
568 | <span class='kw'>if</span> <span class='id identifier rubyid_available_sources'>available_sources</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_source_name'>source_name</span><span class='rparen'>)</span> |
569 | <span class='kw'>if</span> <span class='id identifier rubyid_klass'>klass</span> <span class='op'>=</span> <span class='id identifier rubyid_parse_class'>parse_class</span><span class='lparen'>(</span><span class='id identifier rubyid_camelize'>camelize</span><span class='lparen'>(</span><span class='id identifier rubyid_source_name'>source_name</span><span class='rparen'>)</span><span class='rparen'>)</span> | |
570 | <span class='id identifier rubyid_klass'>klass</span><span class='period'>.</span><span class='id identifier rubyid_enable'>enable</span> | |
571 | <span class='ivar'>@config</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>enabled_sources</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'><<</span> <span class='id identifier rubyid_klass'>klass</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span> | |
572 | <span class='ivar'>@config</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>enabled_sources</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_uniq!'>uniq!</span> | |
573 | <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_save_config'>save_config</span> | |
574 | <span class='kw'>else</span> | |
575 | <span class='id identifier rubyid_raise'>raise</span> <span class='const'>EnableSourceException</span> | |
576 | <span class='kw'>end</span> | |
823e558b | 577 | <span class='kw'>else</span> |
34d0bf15 | 578 | <span class='id identifier rubyid_raise'>raise</span> <span class='const'>UnknownSource</span> |
823e558b BB |
579 | <span class='kw'>end</span> |
580 | <span class='kw'>end</span></pre> | |
581 | </td> | |
582 | </tr> | |
583 | </table> | |
34d0bf15 BB |
584 | </div> |
585 | ||
586 | <div class="method_details "> | |
587 | <h3 class="signature " id="format_sources-instance_method"> | |
588 | ||
589 | - (<tt>Object</tt>) <strong>format_sources</strong>(sources) | |
590 | ||
591 | ||
592 | ||
593 | ||
594 | ||
595 | </h3><table class="source_code"> | |
596 | <tr> | |
597 | <td> | |
598 | <pre class="lines"> | |
599 | ||
600 | ||
601 | 99 | |
602 | 100 | |
603 | 101 | |
604 | 102 | |
605 | 103 | |
606 | 104</pre> | |
607 | </td> | |
608 | <td> | |
609 | <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 99</span> | |
610 | ||
611 | <span class='kw'>def</span> <span class='id identifier rubyid_format_sources'>format_sources</span><span class='lparen'>(</span><span class='id identifier rubyid_sources'>sources</span><span class='rparen'>)</span> | |
612 | <span class='id identifier rubyid_sources'>sources</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_s'>s</span><span class='op'>|</span> | |
613 | <span class='id identifier rubyid_s'>s</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>*</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='ivar'>@config</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>enabled_sources</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_s'>s</span><span class='rparen'>)</span> | |
614 | <span class='id identifier rubyid_s'>s</span> | |
615 | <span class='rbrace'>}</span> | |
616 | <span class='kw'>end</span></pre> | |
617 | </td> | |
618 | </tr> | |
619 | </table> | |
823e558b BB |
620 | </div> |
621 | ||
622 | <div class="method_details "> | |
623 | <h3 class="signature " id="reset-instance_method"> | |
624 | ||
625 | - (<tt>Object</tt>) <strong>reset</strong>(source_name) | |
626 | ||
627 | ||
628 | ||
629 | ||
630 | ||
631 | </h3><table class="source_code"> | |
632 | <tr> | |
633 | <td> | |
634 | <pre class="lines"> | |
635 | ||
636 | ||
34d0bf15 BB |
637 | 47 |
638 | 48 | |
639 | 49 | |
640 | 50 | |
641 | 51 | |
642 | 52 | |
643 | 53 | |
644 | 54 | |
645 | 55 | |
646 | 56 | |
647 | 57 | |
648 | 58</pre> | |
823e558b BB |
649 | </td> |
650 | <td> | |
34d0bf15 | 651 | <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 47</span> |
823e558b BB |
652 | |
653 | <span class='kw'>def</span> <span class='id identifier rubyid_reset'>reset</span><span class='lparen'>(</span><span class='id identifier rubyid_source_name'>source_name</span><span class='rparen'>)</span> | |
34d0bf15 BB |
654 | <span class='kw'>if</span> <span class='id identifier rubyid_available_sources'>available_sources</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_source_name'>source_name</span><span class='rparen'>)</span> |
655 | <span class='kw'>if</span> <span class='id identifier rubyid_klass'>klass</span> <span class='op'>=</span> <span class='id identifier rubyid_parse_class'>parse_class</span><span class='lparen'>(</span><span class='id identifier rubyid_camelize'>camelize</span><span class='lparen'>(</span><span class='id identifier rubyid_source_name'>source_name</span><span class='rparen'>)</span><span class='rparen'>)</span> | |
656 | <span class='id identifier rubyid_klass'>klass</span><span class='period'>.</span><span class='id identifier rubyid_reset'>reset</span> | |
657 | <span class='id identifier rubyid_disable'>disable</span><span class='lparen'>(</span><span class='id identifier rubyid_source_name'>source_name</span><span class='rparen'>)</span> | |
658 | <span class='kw'>else</span> | |
659 | <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ResetSourceException</span> | |
660 | <span class='kw'>end</span> | |
823e558b | 661 | <span class='kw'>else</span> |
34d0bf15 | 662 | <span class='id identifier rubyid_raise'>raise</span> <span class='const'>UnknownSource</span> |
823e558b BB |
663 | <span class='kw'>end</span> |
664 | <span class='kw'>end</span></pre> | |
665 | </td> | |
666 | </tr> | |
667 | </table> | |
668 | </div> | |
669 | ||
670 | </div> | |
671 | ||
672 | </div> | |
673 | ||
674 | <div id="footer"> | |
34d0bf15 | 675 | Generated on Sat Oct 6 02:05:51 2012 by |
823e558b | 676 | <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> |
34d0bf15 | 677 | 0.8.2.1 (ruby-1.9.2). |
823e558b BB |
678 | </div> |
679 | ||
680 | </body> | |
681 | </html> |