X-Git-Url: https://git.r.bdr.sh/rbdr/lyricli.rb/blobdiff_plain/823e558b5cd2ec219d0fc7226c54f2ee7ad807d2..34d0bf15a6f4009de376ceed1d7d5cca24a8dfe7:/doc/Lyricli/Configuration.html 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