X-Git-Url: https://git.r.bdr.sh/rbdr/lyricli.rb/blobdiff_plain/ad84791b951f4ebdfae9c6bf0a54244a8b5c8f16..34d0bf15a6f4009de376ceed1d7d5cca24a8dfe7:/doc/Lyricli/Configuration.html?ds=sidebyside 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 @@
+TODO: Apart from this, load a default yml that will be used for this. +
+# 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
-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
+ + + +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+ |
+
+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.(@config_path) + + if File.exists?(path) + file = File.new(path, "r") + @config = MultiJson.decode(file.read) + else + load_default_config + end +end+ |
+
+ + + +48 +49 +50 +51 +52 +53+ |
+
+ # File 'lib/lyricli/configuration.rb', line 48 + +def save_config + path = File.(@config_path) + file = File.new(path, "w") + file.print(MultiJson.encode(@config)) + file.close +end+ |
+