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">
5 <meta http-equiv=
"Content-Type" content=
"text/html; charset=utf-8" />
7 Class: Lyricli::SourceManager
9 — Documentation by YARD
0.8.1
13 <link rel=
"stylesheet" href=
"../css/style.css" type=
"text/css" media=
"screen" charset=
"utf-8" />
15 <link rel=
"stylesheet" href=
"../css/common.css" type=
"text/css" media=
"screen" charset=
"utf-8" />
17 <script type=
"text/javascript" charset=
"utf-8">
18 hasFrames = window.top.frames.main ? true : false;
20 framesUrl = "../frames.html#!" + escape(window.location.href);
24 <script type=
"text/javascript" charset=
"utf-8" src=
"../js/jquery.js"></script>
26 <script type=
"text/javascript" charset=
"utf-8" src=
"../js/app.js"></script>
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>
37 <span class=
"title">SourceManager
</span>
40 <div class=
"noframes"><span class=
"title">(
</span><a href=
"." target=
"_top">no frames
</a><span class=
"title">)
</span></div>
45 <a class=
"full_list_link" id=
"class_list_link"
46 href=
"../class_list.html">
50 <a class=
"full_list_link" id=
"method_list_link"
51 href=
"../method_list.html">
55 <a class=
"full_list_link" id=
"file_list_link"
56 href=
"../file_list.html">
61 <div class=
"clear"></div>
64 <iframe id=
"search_frame"></iframe>
66 <div id=
"content"><h1>Class: Lyricli::SourceManager
74 <dt class=
"r1">Inherits:
</dt>
76 <span class=
"inheritName">Object
</span>
81 <li class=
"next">Lyricli::SourceManager
</li>
84 <a href=
"#" class=
"inheritanceTree">show all
</a>
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>
100 <dt class=
"r1 last">Defined in:
</dt>
101 <dd class=
"r1 last">lib/lyricli/source_manager.rb
</dd>
104 <div class=
"clear"></div>
115 Instance Method Summary
116 <small>(
<a href=
"#" class=
"summary_toggle">collapse
</a>)
</small>
122 <span class=
"summary_signature">
124 <a href=
"#current_track-instance_method" title=
"#current_track (instance method)">- (Object)
<strong>current_track
</strong> </a>
138 <span class=
"summary_desc"><div class='inline'
></div></span>
144 <span class=
"summary_signature">
146 <a href=
"#disable-instance_method" title=
"#disable (instance method)">- (Object)
<strong>disable
</strong>(source_name)
</a>
160 <span class=
"summary_desc"><div class='inline'
></div></span>
166 <span class=
"summary_signature">
168 <a href=
"#enable-instance_method" title=
"#enable (instance method)">- (Object)
<strong>enable
</strong>(source_name)
</a>
182 <span class=
"summary_desc"><div class='inline'
></div></span>
188 <span class=
"summary_signature">
190 <a href=
"#initialize-instance_method" title=
"#initialize (instance method)">- (SourceManager)
<strong>initialize
</strong> </a>
197 <span class=
"note title constructor">constructor
</span>
206 <span class=
"summary_desc"><div class='inline'
><p>
207 A new instance of SourceManager.
215 <span class=
"summary_signature">
217 <a href=
"#reset-instance_method" title=
"#reset (instance method)">- (Object)
<strong>reset
</strong>(source_name)
</a>
231 <span class=
"summary_desc"><div class='inline'
></div></span>
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>
253 <div class=
"method_details first">
254 <h3 class=
"signature first" id=
"initialize-instance_method">
256 - (
<tt><span class='object_link'
><a href=
"" title=
"Lyricli::SourceManager (class)">SourceManager
</a></span></tt>)
<strong>initialize
</strong>
262 </h3><div class=
"docstring">
263 <div class=
"discussion">
265 A new instance of SourceManager
274 </div><table class=
"source_code">
294 <pre class=
"code"><span class=
"info file"># File 'lib/lyricli/source_manager.rb', line
6</span>
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>
316 <div id=
"instance_method_details" class=
"method_details_list">
317 <h2>Instance Method Details
</h2>
320 <div class=
"method_details first">
321 <h3 class=
"signature first" id=
"current_track-instance_method">
323 - (
<tt>Object
</tt>)
<strong>current_track
</strong>
329 </h3><table class=
"source_code">
348 <pre class=
"code"><span class=
"info file"># File 'lib/lyricli/source_manager.rb', line
46</span>
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>
366 <div class=
"method_details ">
367 <h3 class=
"signature " id=
"disable-instance_method">
369 - (
<tt>Object
</tt>)
<strong>disable
</strong>(source_name)
375 </h3><table class=
"source_code">
390 <pre class=
"code"><span class=
"info file"># File 'lib/lyricli/source_manager.rb', line
29</span>
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>
404 <div class=
"method_details ">
405 <h3 class=
"signature " id=
"enable-instance_method">
407 - (
<tt>Object
</tt>)
<strong>enable
</strong>(source_name)
413 </h3><table class=
"source_code">
430 <pre class=
"code"><span class=
"info file"># File 'lib/lyricli/source_manager.rb', line
19</span>
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>
446 <div class=
"method_details ">
447 <h3 class=
"signature " id=
"reset-instance_method">
449 - (
<tt>Object
</tt>)
<strong>reset
</strong>(source_name)
455 </h3><table class=
"source_code">
471 <pre class=
"code"><span class=
"info file"># File 'lib/lyricli/source_manager.rb', line
37</span>
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>
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>