lib/backup_repos/config.rb in backup_repos-0.1.0 vs lib/backup_repos/config.rb in backup_repos-0.2.0
- old
+ new
@@ -3,11 +3,11 @@
module BackupRepos
class Config
attr_reader :options
- def initialize(options = {})
+ def initialize(options = Hashie::Mash.new({}))
@options = options
end
# === OPTIONS
@@ -26,20 +26,20 @@
end
# ===
def method_missing(name, *_args)
- config[name.to_s]
+ options.send(name) || config[name.to_s]
end
+ def config_file
+ File.join(Dir.home, '.backup-repos')
+ end
+
private
def config
@config ||= Hashie::Mash.new(file_config)
- end
-
- def config_file
- File.join(Dir.home, '.backup-repos')
end
def file_config
return {} unless File.exist?(config_file)
@file_config ||= (YAML.load_file(config_file) || {})