X-Git-Url: https://git.r.bdr.sh/rbdr/lyricli.rb/blobdiff_plain/823e558b5cd2ec219d0fc7226c54f2ee7ad807d2..178ffe1377a571b7ce0a73186c03b5e296ac8922:/doc/Lyricli/SourceManager.html diff --git a/doc/Lyricli/SourceManager.html b/doc/Lyricli/SourceManager.html index 399b337..a8ddaa0 100644 --- a/doc/Lyricli/SourceManager.html +++ b/doc/Lyricli/SourceManager.html @@ -6,7 +6,7 @@
+Manages the different sources. SourceManager is in charge of enabling and +disabling them, as well as getting the current track. +
+ + ++Returns an array with the available sources. +
++Iterates over every source to attempt to retrieve the current song. +
++Disables a source. +
++Enables a source. +
++Adds a star to all members of the array that correspond to an active +source. +
+-A new instance of SourceManager. +Creates a new instance of SourceManager.
+Resets a source. +
+-A new instance of SourceManager +Creates a new instance of SourceManager
@@ -277,10 +353,6 @@ A new instance of SourceManager-6 -7 -8 -9 10 11 12 @@ -288,10 +360,14 @@ A new instance of SourceManager 14 15 16 -17+17 +18 +19 +20 +21
# File 'lib/lyricli/source_manager.rb', line 6 +# File 'lib/lyricli/source_manager.rb', line 10 def initialize @enabled_sources = [] @@ -301,7 +377,7 @@ A new instance of SourceManager current_source = klass.new @enabled_sources << current_source else - raise StartSourceException + raise Exceptions::StartSourceError end end end@@ -318,21 +394,260 @@ A new instance of SourceManager-+ ++
+ + - (Array) available_sources(format = false) + + + + + +
+++++Returns an array with the available sources. Optionally formats the result +so active sources are identified by an appended * +
+ + ++
++ ++ ++ +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122++ +# File 'lib/lyricli/source_manager.rb', line 107 + +def available_sources(format = false) + path_root = File.(File.dirname(__FILE__)) + sources = Dir[path_root+"/sources/*.rb"].map{ |s| + name = s.split("/").last.gsub(/\.rb/, "") + name + } + + # Remove arguments (Hack?) We don't want anybody to touch tihs one. + sources.delete("arguments") + if format + # Add a star to denote enabled sources + format_sources(sources) + else + sources + end +end+++ + - (Hash) current_track + + + + + +
+++++Iterates over every source to attempt to retrieve the current song. +
+ + +