]>
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 | ||
9 | — Documentation by YARD 0.8.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 (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 | ||
124 | <a href="#current_track-instance_method" title="#current_track (instance method)">- (Object) <strong>current_track</strong> </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 | ||
146 | <a href="#disable-instance_method" title="#disable (instance method)">- (Object) <strong>disable</strong>(source_name) </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="#enable-instance_method" title="#enable (instance method)">- (Object) <strong>enable</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="#initialize-instance_method" title="#initialize (instance method)">- (SourceManager) <strong>initialize</strong> </a> | |
191 | ||
192 | ||
193 | ||
194 | </span> | |
195 | ||
196 | ||
197 | <span class="note title constructor">constructor</span> | |
198 | ||
199 | ||
200 | ||
201 | ||
202 | ||
203 | ||
204 | ||
205 | ||
206 | <span class="summary_desc"><div class='inline'><p> | |
207 | A new instance of SourceManager. | |
208 | </p> | |
209 | </div></span> | |
210 | ||
211 | </li> | |
212 | ||
213 | ||
214 | <li class="public "> | |
215 | <span class="summary_signature"> | |
216 | ||
217 | <a href="#reset-instance_method" title="#reset (instance method)">- (Object) <strong>reset</strong>(source_name) </a> | |
218 | ||
219 | ||
220 | ||
221 | </span> | |
222 | ||
223 | ||
224 | ||
225 | ||
226 | ||
227 | ||
228 | ||
229 | ||
230 | ||
231 | <span class="summary_desc"><div class='inline'></div></span> | |
232 | ||
233 | </li> | |
234 | ||
235 | ||
236 | </ul> | |
237 | ||
238 | ||
239 | ||
240 | ||
241 | ||
242 | ||
243 | ||
244 | ||
245 | ||
246 | ||
247 | ||
248 | <h3 class="inherited">Methods included from <span class='object_link'><a href="Util.html" title="Lyricli::Util (module)">Util</a></span></h3> | |
249 | <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> | |
250 | <div id="constructor_details" class="method_details_list"> | |
251 | <h2>Constructor Details</h2> | |
252 | ||
253 | <div class="method_details first"> | |
254 | <h3 class="signature first" id="initialize-instance_method"> | |
255 | ||
256 | - (<tt><span class='object_link'><a href="" title="Lyricli::SourceManager (class)">SourceManager</a></span></tt>) <strong>initialize</strong> | |
257 | ||
258 | ||
259 | ||
260 | ||
261 | ||
262 | </h3><div class="docstring"> | |
263 | <div class="discussion"> | |
264 | <p> | |
265 | A new instance of SourceManager | |
266 | </p> | |
267 | ||
268 | ||
269 | </div> | |
270 | </div> | |
271 | <div class="tags"> | |
272 | ||
273 | ||
274 | </div><table class="source_code"> | |
275 | <tr> | |
276 | <td> | |
277 | <pre class="lines"> | |
278 | ||
279 | ||
280 | 6 | |
281 | 7 | |
282 | 8 | |
283 | 9 | |
284 | 10 | |
285 | 11 | |
286 | 12 | |
287 | 13 | |
288 | 14 | |
289 | 15 | |
290 | 16 | |
291 | 17</pre> | |
292 | </td> | |
293 | <td> | |
294 | <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 6</span> | |
295 | ||
296 | <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span> | |
297 | <span class='ivar'>@enabled_sources</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span> | |
298 | <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> | |
299 | <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> | |
300 | <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> | |
301 | <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> | |
302 | <span class='ivar'>@enabled_sources</span> <span class='op'><<</span> <span class='id identifier rubyid_current_source'>current_source</span> | |
303 | <span class='kw'>else</span> | |
304 | <span class='id identifier rubyid_raise'>raise</span> <span class='const'>StartSourceException</span> | |
305 | <span class='kw'>end</span> | |
306 | <span class='kw'>end</span> | |
307 | <span class='kw'>end</span></pre> | |
308 | </td> | |
309 | </tr> | |
310 | </table> | |
311 | </div> | |
312 | ||
313 | </div> | |
314 | ||
315 | ||
316 | <div id="instance_method_details" class="method_details_list"> | |
317 | <h2>Instance Method Details</h2> | |
318 | ||
319 | ||
320 | <div class="method_details first"> | |
321 | <h3 class="signature first" id="current_track-instance_method"> | |
322 | ||
323 | - (<tt>Object</tt>) <strong>current_track</strong> | |
324 | ||
325 | ||
326 | ||
327 | ||
328 | ||
329 | </h3><table class="source_code"> | |
330 | <tr> | |
331 | <td> | |
332 | <pre class="lines"> | |
333 | ||
334 | ||
335 | 46 | |
336 | 47 | |
337 | 48 | |
338 | 49 | |
339 | 50 | |
340 | 51 | |
341 | 52 | |
342 | 53 | |
343 | 54 | |
344 | 55 | |
345 | 56</pre> | |
346 | </td> | |
347 | <td> | |
348 | <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 46</span> | |
349 | ||
350 | <span class='kw'>def</span> <span class='id identifier rubyid_current_track'>current_track</span> | |
351 | <span class='id identifier rubyid_track'>track</span> <span class='op'>=</span> <span class='kw'>nil</span> | |
352 | <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> | |
353 | <span class='kw'>begin</span> | |
354 | <span class='id identifier rubyid_track'>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> | |
355 | <span class='kw'>rescue</span> | |
356 | <span class='id identifier rubyid_fail'>fail</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Source </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_source'>source</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='rbrace'>}</span><span class='tstring_content'> has failed to start. Please reset the source by running `</span><span class='embexpr_beg'>#{</span><span class='gvar'>$0</span><span class='rbrace'>}</span><span class='tstring_content'> source reset </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_source'>source</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='rbrace'>}</span><span class='tstring_content'>.`</span><span class='tstring_end'>"</span></span> | |
357 | <span class='kw'>end</span> | |
358 | <span class='kw'>end</span> | |
359 | <span class='id identifier rubyid_track'>track</span> | |
360 | <span class='kw'>end</span></pre> | |
361 | </td> | |
362 | </tr> | |
363 | </table> | |
364 | </div> | |
365 | ||
366 | <div class="method_details "> | |
367 | <h3 class="signature " id="disable-instance_method"> | |
368 | ||
369 | - (<tt>Object</tt>) <strong>disable</strong>(source_name) | |
370 | ||
371 | ||
372 | ||
373 | ||
374 | ||
375 | </h3><table class="source_code"> | |
376 | <tr> | |
377 | <td> | |
378 | <pre class="lines"> | |
379 | ||
380 | ||
381 | 29 | |
382 | 30 | |
383 | 31 | |
384 | 32 | |
385 | 33 | |
386 | 34 | |
387 | 35</pre> | |
388 | </td> | |
389 | <td> | |
390 | <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 29</span> | |
391 | ||
392 | <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> | |
393 | <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> | |
394 | <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> | |
395 | <span class='kw'>else</span> | |
396 | <span class='id identifier rubyid_raise'>raise</span> <span class='const'>DisableSourceException</span> | |
397 | <span class='kw'>end</span> | |
398 | <span class='kw'>end</span></pre> | |
399 | </td> | |
400 | </tr> | |
401 | </table> | |
402 | </div> | |
403 | ||
404 | <div class="method_details "> | |
405 | <h3 class="signature " id="enable-instance_method"> | |
406 | ||
407 | - (<tt>Object</tt>) <strong>enable</strong>(source_name) | |
408 | ||
409 | ||
410 | ||
411 | ||
412 | ||
413 | </h3><table class="source_code"> | |
414 | <tr> | |
415 | <td> | |
416 | <pre class="lines"> | |
417 | ||
418 | ||
419 | 19 | |
420 | 20 | |
421 | 21 | |
422 | 22 | |
423 | 23 | |
424 | 24 | |
425 | 25 | |
426 | 26 | |
427 | 27</pre> | |
428 | </td> | |
429 | <td> | |
430 | <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 19</span> | |
431 | ||
432 | <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> | |
433 | <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> | |
434 | <span class='id identifier rubyid_klass'>klass</span><span class='period'>.</span><span class='id identifier rubyid_enable'>enable</span> | |
435 | <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> | |
436 | <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> | |
437 | <span class='kw'>else</span> | |
438 | <span class='id identifier rubyid_raise'>raise</span> <span class='const'>EnableSourceException</span> | |
439 | <span class='kw'>end</span> | |
440 | <span class='kw'>end</span></pre> | |
441 | </td> | |
442 | </tr> | |
443 | </table> | |
444 | </div> | |
445 | ||
446 | <div class="method_details "> | |
447 | <h3 class="signature " id="reset-instance_method"> | |
448 | ||
449 | - (<tt>Object</tt>) <strong>reset</strong>(source_name) | |
450 | ||
451 | ||
452 | ||
453 | ||
454 | ||
455 | </h3><table class="source_code"> | |
456 | <tr> | |
457 | <td> | |
458 | <pre class="lines"> | |
459 | ||
460 | ||
461 | 37 | |
462 | 38 | |
463 | 39 | |
464 | 40 | |
465 | 41 | |
466 | 42 | |
467 | 43 | |
468 | 44</pre> | |
469 | </td> | |
470 | <td> | |
471 | <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 37</span> | |
472 | ||
473 | <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> | |
474 | <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> | |
475 | <span class='id identifier rubyid_klass'>klass</span><span class='period'>.</span><span class='id identifier rubyid_reset'>reset</span> | |
476 | <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> | |
477 | <span class='kw'>else</span> | |
478 | <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ResetSourceException</span> | |
479 | <span class='kw'>end</span> | |
480 | <span class='kw'>end</span></pre> | |
481 | </td> | |
482 | </tr> | |
483 | </table> | |
484 | </div> | |
485 | ||
486 | </div> | |
487 | ||
488 | </div> | |
489 | ||
490 | <div id="footer"> | |
491 | Generated on Fri Oct 5 22:31:14 2012 by | |
492 | <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> | |
493 | 0.8.1 (ruby-1.9.2). | |
494 | </div> | |
495 | ||
496 | </body> | |
497 | </html> |