class MetallumCli::Configuration
Constants
- CONFIG_FILE
Attributes
lang[RW]
Public Class Methods
instance()
click to toggle source
# File lib/metallum-cli/configuration.rb, line 12 def self.instance @instance ||= File.exists?(CONFIG_FILE) ? load_yml() : new.tap(&:defaults) end
load_yml()
click to toggle source
# File lib/metallum-cli/configuration.rb, line 16 def self.load_yml YAML.load_file(CONFIG_FILE) end
save()
click to toggle source
# File lib/metallum-cli/configuration.rb, line 20 def self.save File.open(CONFIG_FILE, 'w+') { |f| f.write(instance.to_yaml) } end
Public Instance Methods
defaults()
click to toggle source
# File lib/metallum-cli/configuration.rb, line 8 def defaults self.lang ||= 'en' end