From: Ben Beltran Date: Sat, 6 Oct 2012 07:19:26 +0000 (-0500) Subject: Adds some documentation X-Git-Url: https://git.r.bdr.sh/rbdr/lyricli.rb/commitdiff_plain/34d0bf15a6f4009de376ceed1d7d5cca24a8dfe7?ds=inline;hp=ad84791b951f4ebdfae9c6bf0a54244a8b5c8f16 Adds some documentation --- diff --git a/.yardoc/checksums b/.yardoc/checksums index 1167f83..475fe5a 100644 --- a/.yardoc/checksums +++ b/.yardoc/checksums @@ -1,9 +1,9 @@ -lib/lyricli.rb 086e293fec4488ede35adbb911723c47205cdd42 -lib/lyricli/util.rb 069f80245171b855a8df437f114e6fd14a750623 -lib/lyricli/sources/rdio.rb 1a689bcee864f3f558bb4d5ee29e6a4bdb449991 -lib/lyricli/lyrics_engine.rb aa9de79d61c208533999db8604123e31f6f99b70 -lib/lyricli/configuration.rb ceebe35a6098aa48fe1f3d788f40350fcc9bf3ed -lib/lyricli/sources/itunes.rb da39a3ee5e6b4b0d3255bfef95601890afd80709 -lib/lyricli/source_manager.rb c3d4c5bb7fec881e4edbcef97d863f1f5974e183 +lib/lyricli.rb 51e33086d1cbac6ccd601dd481a3b455376efb46 +lib/lyricli/util.rb 26284bcf3521994d5f81c5f10a750dad8fda1593 +lib/lyricli/lyricli.rb 067ba6355bce4ce18cc5552580b91b4e266250a2 +lib/lyricli/sources/rdio.rb affae043fecd57d068a54a710718d19933d53b81 +lib/lyricli/lyrics_engine.rb be6feb81f3c3c040420d1fb33df4d1282a959d15 +lib/lyricli/configuration.rb eab80327c885fe827811de01de1e9e64c312b0c0 +lib/lyricli/sources/itunes.rb 8f0b1201051be95df66f8a94554e393681795eb7 +lib/lyricli/source_manager.rb fd571d1c1a169f86efed5c886b40f912fb5ad01f lib/lyricli/sources/arguments.rb de3b31f05d118cf00fccb41e47fd35979da9eb14 -lib/lyricli/lyricli.rb 8a5db180cd047b932626c7eea51a71715c689c1f diff --git a/.yardoc/object_types b/.yardoc/object_types index 04c3b69..dbe4c58 100644 Binary files a/.yardoc/object_types and b/.yardoc/object_types differ diff --git a/.yardoc/objects/root.dat b/.yardoc/objects/root.dat index 13c77bb..9c94980 100644 Binary files a/.yardoc/objects/root.dat and b/.yardoc/objects/root.dat differ diff --git a/.yardoc/proxy_types b/.yardoc/proxy_types index ac416fe..beefda1 100644 Binary files a/.yardoc/proxy_types and b/.yardoc/proxy_types differ diff --git a/doc/Lyricli.html b/doc/Lyricli.html index 8c0685a..8a09e7f 100644 --- a/doc/Lyricli.html +++ b/doc/Lyricli.html @@ -6,7 +6,7 @@ Module: Lyricli - — Documentation by YARD 0.8.1 + — Documentation by YARD 0.8.2.1 @@ -80,13 +80,26 @@
Defined in:
lib/lyricli.rb,
- lib/lyricli/util.rb,
lib/lyricli/sources/rdio.rb,
lib/lyricli/lyrics_engine.rb,
lib/lyricli/configuration.rb,
lib/lyricli/source_manager.rb,
lib/lyricli/sources/arguments.rb
+ lib/lyricli/util.rb,
lib/lyricli/lyricli.rb,
lib/lyricli/sources/rdio.rb,
lib/lyricli/lyrics_engine.rb,
lib/lyricli/configuration.rb,
lib/lyricli/sources/itunes.rb,
lib/lyricli/source_manager.rb,
lib/lyricli/sources/arguments.rb
-

Defined Under Namespace

+

Overview

+
+

+The Lyricli module allows you to easily search for lyrics by looking for +song and artist data from diverse sources. +

+ + +
+
+
+ + +

Defined Under Namespace

@@ -116,7 +129,83 @@

  • - + (Object) execute + + (Object) disable(source_name) + + + + + + + + + + + + + +

    +Disables a source via the Source Manager. +

    +
    + +
  • + + +
  • + + + + (Object) enable(source_name) + + + + + + + + + + + + + +

    +Enables a source via the Source Manager. +

    +
    + +
  • + + +
  • + + + + (String) lyrics + + + + + + + + + + + + + +

    +Creates a new Lyricli instance and returns lyrics by going through the +sources. +

    +
    + +
  • + + +
  • + + + + (Object) reset(source_name) @@ -130,7 +219,60 @@ -
    +

    +Resets all configuration for a source via the Source Manager. +

    +
    + +
  • + + +
  • + + + + (String) sources + + + + + + + + + + + + + +

    +Returns a list of the available sources to enable or disable. +

    +
    + +
  • + + +
  • + + + + (String) version + + + + + + + + + + + + + +

    +Returns the version of the library. +

    +
  • @@ -145,35 +287,323 @@
    -

    +

    - + (Object) execute + + (Object) disable(source_name) -

    +
    +
    +

    +Disables a source via the Source Manager +

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +56
    +57
    +58
    +59
    +
    +
    # File 'lib/lyricli.rb', line 56
    +
    +def self.disable(source_name)
    +  source_manager = SourceManager.new
    +  source_manager.disable(source_name)
    +end
    +
    +
    + +
    +

    + + + (Object) enable(source_name) + + + + + +

    +
    +

    +Enables a source via the Source Manager +

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +50
    +51
    +52
    +53
    +
    +
    # File 'lib/lyricli.rb', line 50
    +
    +def self.enable(source_name)
    +  source_manager = SourceManager.new
    +  source_manager.enable(source_name)
    +end
    +
    +
    + +
    +

    + + + (String) lyrics + + + + + +

    +
    +

    +Creates a new Lyricli instance and returns lyrics by going through the +sources. +

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (String) + + + + — +

      +the fetched lyrics +

      +
      + +
    • + +
    + +
     
     
    -29
     30
     31
    -32
    +32 +33
    -
    # File 'lib/lyricli.rb', line 29
    +      
    # File 'lib/lyricli.rb', line 30
     
    -def self.execute
    +def self.lyrics
       @lyricli = Lyricli.new
       @lyricli.get_lyrics
     end
    +
    + +
    +

    + + + (Object) reset(source_name) + + + + + +

    +
    +

    +Resets all configuration for a source via the Source Manager +

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +62
    +63
    +64
    +65
    +
    +
    # File 'lib/lyricli.rb', line 62
    +
    +def self.reset(source_name)
    +  source_manager = SourceManager.new
    +  source_manager.reset(source_name)
    +end
    +
    +
    + +
    +

    + + + (String) sources + + + + + +

    +
    +

    +Returns a list of the available sources to enable or disable +

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (String) + + + + — +

      +the list of available sources. Enabled sources have a star appended. +

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +44
    +45
    +46
    +47
    +
    +
    # File 'lib/lyricli.rb', line 44
    +
    +def self.sources
    +  source_manager = SourceManager.new
    +  source_manager.available_sources(true).join(", ")
    +end
    +
    +
    + +
    +

    + + + (String) version + + + + + +

    +
    +

    +Returns the version of the library +

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (String) + + + + — +

      +the version +

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +37
    +38
    +39
    +
    +
    # File 'lib/lyricli.rb', line 37
    +
    +def self.version
    +  Gem.loaded_specs["lyricli"].version
    +end
    +
    @@ -181,9 +611,9 @@ diff --git a/doc/Lyricli/Configuration.html b/doc/Lyricli/Configuration.html index 7ca3571..77112a3 100644 --- a/doc/Lyricli/Configuration.html +++ b/doc/Lyricli/Configuration.html @@ -6,7 +6,7 @@ Class: Lyricli::Configuration - — Documentation by YARD 0.8.1 + — Documentation by YARD 0.8.2.1 @@ -196,6 +196,28 @@ +
    + + + + +
  • + + + - (Object) delete(key) + + + + + + + + + + + + +
  • @@ -225,6 +247,53 @@ A new instance of Configuration.

    + + + +
  • + + + - (Object) load_config + + + + + + + + + + + + + +

    +TODO: Apart from this, load a default yml that will be used for this. +

    +
    + +
  • + + +
  • + + + - (Object) save_config + + + + + + + + + + + + + +
    +
  • @@ -264,7 +333,8 @@ A new instance of Configuration 4 5 6 -7 +7 +8
    # File 'lib/lyricli/configuration.rb', line 4
    @@ -272,6 +342,7 @@ A new instance of Configuration
     def initialize
       @config_path = "~/.lyricli.conf"
       @defaults_path = "defaults.json"
    +  @config = nil
     end
    @@ -300,12 +371,12 @@ A new instance of Configuration
     
     
    -11
     12
    -13
    +13 +14 -
    # File 'lib/lyricli/configuration.rb', line 11
    +      
    # File 'lib/lyricli/configuration.rb', line 12
     
     def self.instance
       @@instance
    @@ -336,13 +407,13 @@ A new instance of Configuration
           
     
     
    -15
     16
     17
    -18
    +18 +19
    -
    # File 'lib/lyricli/configuration.rb', line 15
    +      
    # File 'lib/lyricli/configuration.rb', line 16
     
     def [](key)
       load_config unless @config
    @@ -368,14 +439,14 @@ A new instance of Configuration
           
     
     
    -20
     21
     22
     23
    -24
    +24 +25
    -
    # File 'lib/lyricli/configuration.rb', line 20
    +      
    # File 'lib/lyricli/configuration.rb', line 21
     
     def []=(key, value)
       load_config unless @config
    @@ -385,6 +456,133 @@ A new instance of Configuration
         
       
     
    +
    +    
    +      
    +

    + + - (Object) delete(key) + + + + + +

    + + + + +
    +
    +
    +
    +27
    +28
    +29
    +30
    +31
    +
    +
    # File 'lib/lyricli/configuration.rb', line 27
    +
    +def delete(key)
    +  load_config unless @config
    +  @config.delete(key)
    +  save_config
    +end
    +
    +
    + +
    +

    + + - (Object) load_config + + + + + +

    +
    +

    +TODO: Apart from this, load a default yml that will be used for this. And +just extend everything from the user’s config. +

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +45
    +46
    +
    +
    # File 'lib/lyricli/configuration.rb', line 37
    +
    +def load_config
    +  path = File.expand_path(@config_path)
    +
    +  if File.exists?(path)
    +    file = File.new(path, "r")
    +    @config = MultiJson.decode(file.read)
    +  else
    +    load_default_config
    +  end
    +end
    +
    +
    + +
    +

    + + - (Object) save_config + + + + + +

    + + + + +
    +
    +
    +
    +48
    +49
    +50
    +51
    +52
    +53
    +
    +
    # File 'lib/lyricli/configuration.rb', line 48
    +
    +def save_config
    +  path = File.expand_path(@config_path)
    +  file = File.new(path, "w")
    +  file.print(MultiJson.encode(@config))
    +  file.close
    +end
    +
    @@ -392,9 +590,9 @@ A new instance of Configuration diff --git a/doc/Lyricli/Lyricli.html b/doc/Lyricli/Lyricli.html index 6d8ed13..090262d 100644 --- a/doc/Lyricli/Lyricli.html +++ b/doc/Lyricli/Lyricli.html @@ -6,7 +6,7 @@ Class: Lyricli::Lyricli - — Documentation by YARD 0.8.1 + — Documentation by YARD 0.8.2.1 @@ -94,7 +94,7 @@
    Defined in:
    -
    lib/lyricli.rb
    +
    lib/lyricli/lyricli.rb
    @@ -262,12 +262,12 @@ A new instance of Lyricli
     
     
    -36
    -37
    -38
    +4 +5 +6
    -
    # File 'lib/lyricli.rb', line 36
    +      
    # File 'lib/lyricli/lyricli.rb', line 4
     
     def initialize
       @source_manager = SourceManager.new
    @@ -299,13 +299,13 @@ A new instance of Lyricli
           
     
     
    -61
    -62
    -63
    -64
    +29 +30 +31 +32
    -
    # File 'lib/lyricli.rb', line 61
    +      
    # File 'lib/lyricli/lyricli.rb', line 29
     
     def check_params
       self.exit_with_error if @current_track[:artist].nil? or @current_track[:artist].empty?
    @@ -325,21 +325,43 @@ A new instance of Lyricli
       
     
       
    -
    +
    +
    + + +
    +
    +
    + +

    Raises:

    +
      + +
    • + + + (InvalidLyrics) + + + +
    • + +
    + +
    @@ -361,21 +383,21 @@ A new instance of Lyricli
     
     
    -44
    -45
    -46
    -47
    -48
    -49
    -50
    -51
    -52
    -53
    -54
    -55
    +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 @@ -424,23 +554,69 @@ A new instance of SourceManager 24 25 26 -27 +27 +28 +29 +30 +31 +32
     
     
    -40
    -41
    -42
    +8 +9 +10
    -
    # File 'lib/lyricli.rb', line 40
    +      
    # File 'lib/lyricli/lyricli.rb', line 8
     
     def exit_with_error
    -  abort "Usage: #{$0} artist song"
    +  raise InvalidLyrics
     end
    -
    # File 'lib/lyricli.rb', line 44
    +      
    # File 'lib/lyricli/lyricli.rb', line 12
     
     def get_lyrics
       set_current_track
    @@ -409,12 +431,12 @@ A new instance of Lyricli
           
     
     
    -57
    -58
    -59
    +25 +26 +27
    -
    # File 'lib/lyricli.rb', line 57
    +      
    # File 'lib/lyricli/lyricli.rb', line 25
     
     def set_current_track
       @current_track = @source_manager.current_track
    @@ -429,9 +451,9 @@ A new instance of Lyricli
     
     
         
     
       
    diff --git a/doc/Lyricli/LyricsEngine.html b/doc/Lyricli/LyricsEngine.html
    index 5cca795..23a5f73 100644
    --- a/doc/Lyricli/LyricsEngine.html
    +++ b/doc/Lyricli/LyricsEngine.html
    @@ -6,7 +6,7 @@
     
       Class: Lyricli::LyricsEngine
       
    -    — Documentation by YARD 0.8.1
    +    — Documentation by YARD 0.8.2.1
       
     
     
    @@ -304,9 +304,9 @@ A new instance of LyricsEngine
     
     
         
     
       
    diff --git a/doc/Lyricli/SourceManager.html b/doc/Lyricli/SourceManager.html
    index 399b337..2f48f97 100644
    --- a/doc/Lyricli/SourceManager.html
    +++ b/doc/Lyricli/SourceManager.html
    @@ -6,7 +6,7 @@
     
       Class: Lyricli::SourceManager
       
    -    — Documentation by YARD 0.8.1
    +    — Documentation by YARD 0.8.2.1
       
     
     
    @@ -121,6 +121,28 @@
             
  • + - (Object) available_sources(format = false) + + + + + + + + + + + + + +
    + +
  • + + +
  • + + - (Object) current_track @@ -179,6 +201,28 @@ +
    + +
  • + + +
  • + + + - (Object) format_sources(sources) + + + + + + + + + + + + +
  • @@ -318,7 +362,65 @@ A new instance of SourceManager
    -

    +

    + + - (Object) available_sources(format = false) + + + + + +

    + + + + +
    +
    +
    +
    +81
    +82
    +83
    +84
    +85
    +86
    +87
    +88
    +89
    +90
    +91
    +92
    +93
    +94
    +95
    +96
    +97
    +
    +
    # File 'lib/lyricli/source_manager.rb', line 81
    +
    +def available_sources(format = false)
    +  path_root = File.expand_path(File.dirname(__FILE__))
    +  sources = Dir[path_root+"/sources/*.rb"].map{ |s|
    +    name = s.split("/").last.gsub(/\.rb/, "")
    +
    +    # Add a star to denote enabled sources
    +    name
    +  }
    +
    +  # Remove arguments (Hack?) We don't want anybody to touch tihs one.
    +  sources.delete("arguments")
    +  if format
    +    format_sources(sources)
    +  else
    +    sources
    +  end
    +end
    +
    +
    + +
    +

    - (Object) current_track @@ -332,28 +434,46 @@ A new instance of SourceManager
     
     
    -46
    -47
    -48
    -49
    -50
    -51
    -52
    -53
    -54
    -55
    -56
    +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79

    -
    # File 'lib/lyricli/source_manager.rb', line 46
    +      
    # File 'lib/lyricli/source_manager.rb', line 60
     
     def current_track
       track = nil
    +  lock = false
       @enabled_sources.each do |source|
         begin
    -      track ||= source.current_track
    +      current_track = source.current_track
    +
    +      # This is a special thing for arguments. The thing is, they need to
    +      # be inputted manually. So, if they are present they won't allow
    +      # anyone else to give results. Makes sense, yet a bit hacky.
    +      unless current_track[:artist].nil? || current_track[:artist].empty? || current_track[:song].nil? || current_track[:song].empty?
    +        track = current_track unless lock
    +        lock = true if source.class.name == "arguments"
    +      end
         rescue
    -      fail "Source #{source.name} has failed to start. Please reset the source by running `#{$0} source reset #{source.name}.`"
    +      raise SourceConfigurationException
         end
       end
       track
    @@ -378,22 +498,32 @@ A new instance of SourceManager
           
     
     
    -29
    -30
    -31
    -32
    -33
     34
    -35
    +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45
    -
    # File 'lib/lyricli/source_manager.rb', line 29
    +      
    # File 'lib/lyricli/source_manager.rb', line 34
     
     def disable(source_name)
    -  if klass = parse_class(camelize(source_name))
    -    @config["enabled_sources"].delete(klass.name)
    +  if available_sources.include?(source_name)
    +    if klass = parse_class(camelize(source_name))
    +      @config["enabled_sources"].delete(klass.name)
    +      @config.save_config
    +    else
    +      raise DisableSourceException
    +    end
       else
    -    raise DisableSourceException
    +    raise UnknownSource
       end
     end
    # File 'lib/lyricli/source_manager.rb', line 19
     
     def enable(source_name)
    -  if klass = parse_class(camelize(source_name))
    -    klass.enable
    -    @config["enabled_sources"] << klass.name
    -    @config["enabled_sources"].uniq!
    +  if available_sources.include?(source_name)
    +    if klass = parse_class(camelize(source_name))
    +      klass.enable
    +      @config["enabled_sources"] << klass.name
    +      @config["enabled_sources"].uniq!
    +      @config.save_config
    +    else
    +      raise EnableSourceException
    +    end
       else
    -    raise EnableSourceException
    +    raise UnknownSource
       end
     end
    + + +
    +

    + + - (Object) format_sources(sources) + + + + + +

    + + + + +
    +
    +
    +
    +99
    +100
    +101
    +102
    +103
    +104
    +
    +
    # File 'lib/lyricli/source_manager.rb', line 99
    +
    +def format_sources(sources)
    +  sources.map{ |s|
    +    s << "*" if @config["enabled_sources"].include?(s)
    +    s
    +  }
    +end
    +
    @@ -458,24 +634,32 @@ A new instance of SourceManager
     
     
    -37
    -38
    -39
    -40
    -41
    -42
    -43
    -44
    +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58
    -
    # File 'lib/lyricli/source_manager.rb', line 37
    +      
    # File 'lib/lyricli/source_manager.rb', line 47
     
     def reset(source_name)
    -  if klass = parse_class(camelize(source_name))
    -    klass.reset
    -    disable(source_name)
    +  if available_sources.include?(source_name)
    +    if klass = parse_class(camelize(source_name))
    +      klass.reset
    +      disable(source_name)
    +    else
    +      raise ResetSourceException
    +    end
       else
    -    raise ResetSourceException
    +    raise UnknownSource
       end
     end
    @@ -488,9 +672,9 @@ A new instance of SourceManager diff --git a/doc/Lyricli/Sources.html b/doc/Lyricli/Sources.html index f2b0712..ad3a5a1 100644 --- a/doc/Lyricli/Sources.html +++ b/doc/Lyricli/Sources.html @@ -6,7 +6,7 @@ Module: Lyricli::Sources - — Documentation by YARD 0.8.1 + — Documentation by YARD 0.8.2.1 @@ -80,7 +80,7 @@
    Defined in:
    lib/lyricli/sources/rdio.rb,
    - lib/lyricli/sources/arguments.rb
    + lib/lyricli/sources/itunes.rb,
    lib/lyricli/sources/arguments.rb
    @@ -92,7 +92,7 @@ - Classes: Arguments, Rdio + Classes: Arguments, Itunes, Rdio

    @@ -108,9 +108,9 @@ diff --git a/doc/Lyricli/Sources/Arguments.html b/doc/Lyricli/Sources/Arguments.html index da2f0a1..6f0be65 100644 --- a/doc/Lyricli/Sources/Arguments.html +++ b/doc/Lyricli/Sources/Arguments.html @@ -6,7 +6,7 @@ Class: Lyricli::Sources::Arguments - — Documentation by YARD 0.8.1 + — Documentation by YARD 0.8.2.1 @@ -315,7 +315,6 @@ Instantiates everything it needs to run. -

    @@ -527,9 +526,9 @@ A hash containing the current `:song` and `:artist`.

    diff --git a/doc/Lyricli/Sources/Rdio.html b/doc/Lyricli/Sources/Rdio.html index e99af89..51ce909 100644 --- a/doc/Lyricli/Sources/Rdio.html +++ b/doc/Lyricli/Sources/Rdio.html @@ -6,7 +6,7 @@ Class: Lyricli::Sources::Rdio - — Documentation by YARD 0.8.1 + — Documentation by YARD 0.8.2.1 @@ -319,19 +319,19 @@ Instantiates everything it needs to run.
     
     
    -23
    -24
    -25
    -26
    -27
    +27 +28 +29 +30 +31
    -
    # File 'lib/lyricli/sources/rdio.rb', line 23
    +      
    # File 'lib/lyricli/sources/rdio.rb', line 27
     
     def initialize
       @name = 'rdio'
    -  @config = Lyricli::Configuration.instance
    -  @rdio = Rdio::SimpleRdio.new([@config["rdio_key"], @config["rdio_secret"]], @config["rdio_auth_token"])
    +  @config = Configuration.instance
    +  @rdio = ::Rdio::SimpleRdio.new([@config["rdio_key"], @config["rdio_secret"]], @config["rdio_auth_token"])
     end
    @@ -345,7 +345,6 @@ Instantiates everything it needs to run. -

    @@ -423,11 +422,6 @@ token.
     
     
    -46
    -47
    -48
    -49
    -50
     51
     52
     53
    @@ -439,19 +433,24 @@ token.
     59
     60
     61
    -62
    +62 +63 +64 +65 +66 +67

    -
    # File 'lib/lyricli/sources/rdio.rb', line 46
    +      
    # File 'lib/lyricli/sources/rdio.rb', line 51
     
     def self.create_auth_token
    -  @rdio = Rdio::SimpleRdio.new([@config["rdio_key"], @config["rdio_secret"]], @config["rdio_auth_token"])
    +  rdio = ::Rdio::SimpleRdio.new([@config["rdio_key"], @config["rdio_secret"]], @config["rdio_auth_token"])
     
       # Request Authorization
       puts "Follow this URL to authorize lyricli:"
       auth_url = rdio.begin_authentication('oob')
       puts auth_url
    -  Launchy.open(auth_url)
    +  ::Launchy.open(auth_url)
     
       # Request Code, Obtain Token
       print "Please type the authorization code: "
    @@ -501,18 +500,26 @@ source. In the case of Rdio it has to authenticate with OAuth.
     17
     18
     19
    -20
    +20 +21 +22 +23 +24
    # File 'lib/lyricli/sources/rdio.rb', line 13
     
     def self.enable
       # Validation Code
    -  @config = Lyricli::Configuration.instance
    +  @config = Configuration.instance
       unless @config["rdio_auth_token"] && !@config["rdio_auth_token"].empty?
         create_auth_token
       end
     
    +  puts "***"
    +  puts "Hello, rdio tends to be a bit aggressive and tends to have trouble with other sources. If you're having trouble, you can disable it temporarily. You will not have to reauthenticate."
    +  puts "***"
    +
     end
    @@ -546,16 +553,18 @@ The reset method resets any configurations it may have
     
     
    -40
    -41
    -42
    +44 +45 +46 +47
    -
    # File 'lib/lyricli/sources/rdio.rb', line 40
    +      
    # File 'lib/lyricli/sources/rdio.rb', line 44
     
     def self.reset
    -  # Reset Code
    -end
    + @config = Configuration.instance + @config.delete("rdio_auth_token") +end
    @@ -614,15 +623,15 @@ A hash containing the current `:song` and `:artist`.
     
     
    -32
    -33
    -34
    -35
     36
    -37
    +37 +38 +39 +40 +41
    -
    # File 'lib/lyricli/sources/rdio.rb', line 32
    +      
    # File 'lib/lyricli/sources/rdio.rb', line 36
     
     def current_track
       response = @rdio.call('currentUser', {'extras' => 'lastSongPlayed'})
    @@ -640,9 +649,9 @@ A hash containing the current `:song` and `:artist`.
     
     
         
     
       
    diff --git a/doc/Lyricli/Util.html b/doc/Lyricli/Util.html
    index 71499bf..b1a24d6 100644
    --- a/doc/Lyricli/Util.html
    +++ b/doc/Lyricli/Util.html
    @@ -6,7 +6,7 @@
     
       Module: Lyricli::Util
       
    -    — Documentation by YARD 0.8.1
    +    — Documentation by YARD 0.8.2.1
       
     
     
    @@ -88,8 +88,20 @@
     
     
    +

    Overview

    +
    +

    +This module contains several utility functions. +

    +
    +
    +
    + + +
    + @@ -106,7 +118,7 @@
  • - - (Object) camelize(str) + - (String) camelize(str) @@ -120,7 +132,10 @@ -
    +

    +Transforms a string from snake_case to UpperCamelCase. +

    +
  • @@ -128,7 +143,7 @@
  • - - (Object) parse_class(class_name) + - (Class?) parse_class(class_name) @@ -142,7 +157,11 @@ -
    +

    +Takes a class name in snake_case and attempts to find the corresponding +class from the sources. +

    +
  • @@ -150,7 +169,7 @@
  • - - (Object) sanitize_param(p) + - (String) sanitize_param(p) @@ -164,7 +183,11 @@ -
    +

    +Simply escapes a param and substitutes spaces and escaped plus signs for +plus signs. +

    +
  • @@ -181,24 +204,76 @@

    - - (Object) camelize(str) + - (String) camelize(str) -

    +
    +
    +

    +Transforms a string from snake_case to UpperCamelCase +

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + str + + + (String) + + + + — +

      +the string that will be Camelized +

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (String) + + + + — +

      +the Camelized string. +

      +
      + +
    • + +
    + +
     
     
    -3
    -4
    -5
    +9 +10 +11
    -
    # File 'lib/lyricli/util.rb', line 3
    +      
    # File 'lib/lyricli/util.rb', line 9
     
     def camelize(str)
       str.split('_').map {|w| w.capitalize}.join
    @@ -211,29 +286,82 @@
           

    - - (Object) parse_class(class_name) + - (Class?) parse_class(class_name) -

    +
    +
    +

    +Takes a class name in snake_case and attempts to find the corresponding +class from the sources. +

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + class_name + + + (String) + + + + — +

      +the snake_case name of the class to search for. +

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Class, nil) + + + + — +

      +the found class or nil +

      +
      + +
    • + +
    + +
     
     
    -7
    -8
    -9
    -10
    -11
    -12
    -13
    -14
    +18 +19 +20 +21 +22 +23 +24 +25
    -
    # File 'lib/lyricli/util.rb', line 7
    +      
    # File 'lib/lyricli/util.rb', line 18
     
     def parse_class(class_name)
       begin
    @@ -251,24 +379,77 @@
           

    - - (Object) sanitize_param(p) + - (String) sanitize_param(p) + + + + +

    +
    +

    +Simply escapes a param and substitutes spaces and escaped plus signs for +plus signs. +

    + +
    +
    +
    +

    Parameters:

    +
      +
    • + + p + + + (String) + + + + — +

      +the parameter to be sanitized +

      +
      + +
    • + +
    +

    Returns:

    +
      + +
    • + + + (String) + + + + — +

      +the sanitized parameter +

      +
      + +
    • - + + +
       
       
      -16
      -17
      -18
      +32 +33 +34
      -
      # File 'lib/lyricli/util.rb', line 16
      +      
      # File 'lib/lyricli/util.rb', line 32
       
       def sanitize_param(p)
         URI.encode_www_form_component(p.gsub(/ /, "+")).gsub("%2B", "+")
      @@ -283,9 +464,9 @@
       
       
           
       
         
      diff --git a/doc/_index.html b/doc/_index.html
      index 7d92f25..d505ea5 100644
      --- a/doc/_index.html
      +++ b/doc/_index.html
      @@ -4,7 +4,7 @@
         
           
       
      -  Documentation by YARD 0.8.1
      +  Documentation by YARD 0.8.2.1
         
       
       
      @@ -56,10 +56,19 @@
       
           
       
      -    

      Documentation by YARD 0.8.1

      +

      Documentation by YARD 0.8.2.1

      Alphabetic Index

      +

      File Listing

      + +

      Namespace Listing A-Z

      @@ -101,22 +110,37 @@ -
      diff --git a/doc/class_list.html b/doc/class_list.html index 6652d8b..ca6a9fe 100644 --- a/doc/class_list.html +++ b/doc/class_list.html @@ -45,7 +45,7 @@
      diff --git a/doc/file_list.html b/doc/file_list.html index 1f6ffe3..9393d92 100644 --- a/doc/file_list.html +++ b/doc/file_list.html @@ -46,6 +46,9 @@
      diff --git a/doc/frames.html b/doc/frames.html index a9e232b..892743e 100644 --- a/doc/frames.html +++ b/doc/frames.html @@ -4,7 +4,7 @@ - Documentation by YARD 0.8.1 + Documentation by YARD 0.8.2.1