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.2.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>
106 <h2>Overview
</h2><div class=
"docstring">
107 <div class=
"discussion">
109 Manages the different sources. SourceManager is in charge of enabling and
110 disabling them, as well as getting the current track.
128 Instance Method Summary
129 <small>(
<a href=
"#" class=
"summary_toggle">collapse
</a>)
</small>
135 <span class=
"summary_signature">
137 <a href=
"#available_sources-instance_method" title=
"#available_sources (instance method)">- (Array)
<strong>available_sources
</strong>(format = false)
</a>
151 <span class=
"summary_desc"><div class='inline'
><p>
152 Returns an array with the available sources.
160 <span class=
"summary_signature">
162 <a href=
"#current_track-instance_method" title=
"#current_track (instance method)">- (Hash)
<strong>current_track
</strong> </a>
176 <span class=
"summary_desc"><div class='inline'
><p>
177 Iterates over every source to attempt to retrieve the current song.
185 <span class=
"summary_signature">
187 <a href=
"#disable-instance_method" title=
"#disable (instance method)">- (Object)
<strong>disable
</strong>(source_name)
</a>
201 <span class=
"summary_desc"><div class='inline'
><p>
210 <span class=
"summary_signature">
212 <a href=
"#enable-instance_method" title=
"#enable (instance method)">- (Object)
<strong>enable
</strong>(source_name)
</a>
226 <span class=
"summary_desc"><div class='inline'
><p>
235 <span class=
"summary_signature">
237 <a href=
"#format_sources-instance_method" title=
"#format_sources (instance method)">- (Array)
<strong>format_sources
</strong>(sources)
</a>
251 <span class=
"summary_desc"><div class='inline'
><p>
252 Adds a star to all members of the array that correspond to an active
261 <span class=
"summary_signature">
263 <a href=
"#initialize-instance_method" title=
"#initialize (instance method)">- (SourceManager)
<strong>initialize
</strong> </a>
270 <span class=
"note title constructor">constructor
</span>
279 <span class=
"summary_desc"><div class='inline'
><p>
280 Creates a new instance of SourceManager.
288 <span class=
"summary_signature">
290 <a href=
"#reset-instance_method" title=
"#reset (instance method)">- (Object)
<strong>reset
</strong>(source_name)
</a>
304 <span class=
"summary_desc"><div class='inline'
><p>
324 <h3 class=
"inherited">Methods included from
<span class='object_link'
><a href=
"Util.html" title=
"Lyricli::Util (module)">Util
</a></span></h3>
325 <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>
326 <div id=
"constructor_details" class=
"method_details_list">
327 <h2>Constructor Details
</h2>
329 <div class=
"method_details first">
330 <h3 class=
"signature first" id=
"initialize-instance_method">
332 - (
<tt><span class='object_link'
><a href=
"" title=
"Lyricli::SourceManager (class)">SourceManager
</a></span></tt>)
<strong>initialize
</strong>
338 </h3><div class=
"docstring">
339 <div class=
"discussion">
341 Creates a new instance of SourceManager
350 </div><table class=
"source_code">
370 <pre class=
"code"><span class=
"info file"># File 'lib/lyricli/source_manager.rb', line
10</span>
372 <span class='kw'
>def
</span> <span class='id identifier rubyid_initialize'
>initialize
</span>
373 <span class='ivar'
>@enabled_sources
</span> <span class='op'
>=
</span> <span class='lbracket'
>[
</span><span class='rbracket'
>]
</span>
374 <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>
375 <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>
376 <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>
377 <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>
378 <span class='ivar'
>@enabled_sources
</span> <span class='op'
><<</span> <span class='id identifier rubyid_current_source'
>current_source
</span>
379 <span class='kw'
>else
</span>
380 <span class='id identifier rubyid_raise'
>raise
</span> <span class='const'
>Exceptions
</span><span class='op'
>::
</span><span class='const'
>StartSourceError
</span>
381 <span class='kw'
>end
</span>
382 <span class='kw'
>end
</span>
383 <span class='kw'
>end
</span></pre>
392 <div id=
"instance_method_details" class=
"method_details_list">
393 <h2>Instance Method Details
</h2>
396 <div class=
"method_details first">
397 <h3 class=
"signature first" id=
"available_sources-instance_method">
399 - (
<tt>Array
</tt>)
<strong>available_sources
</strong>(format = false)
405 </h3><div class=
"docstring">
406 <div class=
"discussion">
408 Returns an array with the available sources. Optionally formats the result
409 so active sources are identified by an appended *
416 <p class=
"tag_title">Parameters:
</p>
421 <span class='name'
>format
</span>
424 <span class='type'
>(
<tt>Boolean
</tt>)
</span>
427 <em class=
"default">(defaults to:
<tt>false
</tt>)
</em>
431 <div class='inline'
><p>
432 whether or not to render the stars for active sources.
440 <p class=
"tag_title">Returns:
</p>
446 <span class='type'
>(
<tt>Array
</tt>)
</span>
451 <div class='inline'
><p>
452 the names of the currently available sources.
460 </div><table class=
"source_code">
484 <pre class=
"code"><span class=
"info file"># File 'lib/lyricli/source_manager.rb', line
107</span>
486 <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>
487 <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>
488 <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>
489 <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>
490 <span class='id identifier rubyid_name'
>name
</span>
491 <span class='rbrace'
>}
</span>
493 <span class='comment'
># Remove arguments (Hack?) We don't want anybody to touch tihs one.
494 </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>
495 <span class='kw'
>if
</span> <span class='id identifier rubyid_format'
>format
</span>
496 <span class='comment'
># Add a star to denote enabled sources
497 </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>
498 <span class='kw'
>else
</span>
499 <span class='id identifier rubyid_sources'
>sources
</span>
500 <span class='kw'
>end
</span>
501 <span class='kw'
>end
</span></pre>
507 <div class=
"method_details ">
508 <h3 class=
"signature " id=
"current_track-instance_method">
510 - (
<tt>Hash
</tt>)
<strong>current_track
</strong>
516 </h3><div class=
"docstring">
517 <div class=
"discussion">
519 Iterates over every source to attempt to retrieve the current song.
527 <p class=
"tag_title">Returns:
</p>
533 <span class='type'
>(
<tt>Hash
</tt>)
</span>
538 <div class='inline'
><p>
539 the current track, has an `:artist` and `:song` key.
547 </div><table class=
"source_code">
575 <pre class=
"code"><span class=
"info file"># File 'lib/lyricli/source_manager.rb', line
80</span>
577 <span class='kw'
>def
</span> <span class='id identifier rubyid_current_track'
>current_track
</span>
578 <span class='id identifier rubyid_track'
>track
</span> <span class='op'
>=
</span> <span class='kw'
>nil
</span>
579 <span class='id identifier rubyid_lock'
>lock
</span> <span class='op'
>=
</span> <span class='kw'
>false
</span>
580 <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>
581 <span class='kw'
>begin
</span>
582 <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>
584 <span class='comment'
># This is a special thing for arguments. The thing is, they need to
585 </span> <span class='comment'
># be inputted manually. So, if they are present they won't allow
586 </span> <span class='comment'
># anyone else to give results. Makes sense, yet a bit hacky.
587 </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>
588 <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>
589 <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>
590 <span class='kw'
>end
</span>
591 <span class='kw'
>rescue
</span>
592 <span class='id identifier rubyid_raise'
>raise
</span> <span class='const'
>Exceptions
</span><span class='op'
>::
</span><span class='const'
>SourceConfigurationError
</span>
593 <span class='kw'
>end
</span>
594 <span class='kw'
>end
</span>
595 <span class='id identifier rubyid_track'
>track
</span>
596 <span class='kw'
>end
</span></pre>
602 <div class=
"method_details ">
603 <h3 class=
"signature " id=
"disable-instance_method">
605 - (
<tt>Object
</tt>)
<strong>disable
</strong>(source_name)
611 </h3><div class=
"docstring">
612 <div class=
"discussion">
614 Disables a source. This only removes the source from the `enabled_sources`
622 <p class=
"tag_title">Parameters:
</p>
627 <span class='name'
>source_name
</span>
630 <span class='type'
>(
<tt>String
</tt>)
</span>
635 <div class='inline'
><p>
636 the name of the source to disable
645 </div><table class=
"source_code">
665 <pre class=
"code"><span class=
"info file"># File 'lib/lyricli/source_manager.rb', line
47</span>
667 <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>
668 <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>
669 <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>
670 <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>
671 <span class='ivar'
>@config
</span><span class='period'
>.
</span><span class='id identifier rubyid_save_config'
>save_config
</span>
672 <span class='kw'
>else
</span>
673 <span class='id identifier rubyid_raise'
>raise
</span> <span class='const'
>Exceptions
</span><span class='op'
>::
</span><span class='const'
>DisableSourceError
</span>
674 <span class='kw'
>end
</span>
675 <span class='kw'
>else
</span>
676 <span class='id identifier rubyid_raise'
>raise
</span> <span class='const'
>Exceptions
</span><span class='op'
>::
</span><span class='const'
>UnknownSourceError
</span>
677 <span class='kw'
>end
</span>
678 <span class='kw'
>end
</span></pre>
684 <div class=
"method_details ">
685 <h3 class=
"signature " id=
"enable-instance_method">
687 - (
<tt>Object
</tt>)
<strong>enable
</strong>(source_name)
693 </h3><div class=
"docstring">
694 <div class=
"discussion">
696 Enables a source. This runs the source
’s enable method and adds it to
697 the `enabled_sources` configuration key. It will only enable sources that
698 are
“available
” (see #available_sources)
705 <p class=
"tag_title">Parameters:
</p>
710 <span class='name'
>source_name
</span>
713 <span class='type'
>(
<tt>String
</tt>)
</span>
718 <div class='inline'
><p>
719 the name of the source to enable
728 </div><table class=
"source_code">
750 <pre class=
"code"><span class=
"info file"># File 'lib/lyricli/source_manager.rb', line
28</span>
752 <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>
753 <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>
754 <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>
755 <span class='id identifier rubyid_klass'
>klass
</span><span class='period'
>.
</span><span class='id identifier rubyid_enable'
>enable
</span>
756 <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>
757 <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>
758 <span class='ivar'
>@config
</span><span class='period'
>.
</span><span class='id identifier rubyid_save_config'
>save_config
</span>
759 <span class='kw'
>else
</span>
760 <span class='id identifier rubyid_raise'
>raise
</span> <span class='const'
>Exceptions
</span><span class='op'
>::
</span><span class='const'
>EnableSourceError
</span>
761 <span class='kw'
>end
</span>
762 <span class='kw'
>else
</span>
763 <span class='id identifier rubyid_raise'
>raise
</span> <span class='const'
>Exceptions
</span><span class='op'
>::
</span><span class='const'
>UnknownSourceError
</span>
764 <span class='kw'
>end
</span>
765 <span class='kw'
>end
</span></pre>
771 <div class=
"method_details ">
772 <h3 class=
"signature " id=
"format_sources-instance_method">
774 - (
<tt>Array
</tt>)
<strong>format_sources
</strong>(sources)
780 </h3><div class=
"docstring">
781 <div class=
"discussion">
783 Adds a star to all members of the array that correspond to an active source
790 <p class=
"tag_title">Parameters:
</p>
795 <span class='name'
>sources
</span>
798 <span class='type'
>(
<tt>Array
</tt>)
</span>
803 <div class='inline'
><p>
804 the array of sources to format
812 <p class=
"tag_title">Returns:
</p>
818 <span class='type'
>(
<tt>Array
</tt>)
</span>
823 <div class='inline'
><p>
832 </div><table class=
"source_code">
846 <pre class=
"code"><span class=
"info file"># File 'lib/lyricli/source_manager.rb', line
129</span>
848 <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>
849 <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>
850 <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>
851 <span class='id identifier rubyid_s'
>s
</span>
852 <span class='rbrace'
>}
</span>
853 <span class='kw'
>end
</span></pre>
859 <div class=
"method_details ">
860 <h3 class=
"signature " id=
"reset-instance_method">
862 - (
<tt>Object
</tt>)
<strong>reset
</strong>(source_name)
868 </h3><div class=
"docstring">
869 <div class=
"discussion">
871 Resets a source. This runs the source
’s reset method. It will also
879 <p class=
"tag_title">Parameters:
</p>
884 <span class='name'
>source_name
</span>
887 <span class='type'
>(
<tt>String
</tt>)
</span>
892 <div class='inline'
><p>
893 the name of the source to reset.
902 </div><table class=
"source_code">
922 <pre class=
"code"><span class=
"info file"># File 'lib/lyricli/source_manager.rb', line
64</span>
924 <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>
925 <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>
926 <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>
927 <span class='id identifier rubyid_klass'
>klass
</span><span class='period'
>.
</span><span class='id identifier rubyid_reset'
>reset
</span>
928 <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>
929 <span class='kw'
>else
</span>
930 <span class='id identifier rubyid_raise'
>raise
</span> <span class='const'
>Exceptions
</span><span class='op'
>::
</span><span class='const'
>ResetSourceError
</span>
931 <span class='kw'
>end
</span>
932 <span class='kw'
>else
</span>
933 <span class='id identifier rubyid_raise'
>raise
</span> <span class='const'
>Exceptions
</span><span class='op'
>::
</span><span class='const'
>UnknownSourceError
</span>
934 <span class='kw'
>end
</span>
935 <span class='kw'
>end
</span></pre>
946 Generated on Sat Oct
6 03:
20:
24 2012 by
947 <a href=
"http://yardoc.org" title=
"Yay! A Ruby Documentation Tool" target=
"_parent">yard
</a>
948 0.8.2.1 (ruby-
1.9.2).