Class: BackupRepos::Config
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(options = Hashie::Mash.new({})) ⇒ Config
Returns a new instance of Config.
8
9
10
|
# File 'lib/backup_repos/config.rb', line 8
def initialize(options = Hashie::Mash.new({}))
@options = options
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *_args) ⇒ Object
30
31
32
|
# File 'lib/backup_repos/config.rb', line 30
def method_missing(name, *_args)
options.send(name) || config[name.to_s] || super
end
|
Instance Attribute Details
Returns the value of attribute options.
6
7
8
|
# File 'lib/backup_repos/config.rb', line 6
def options
@options
end
|
Instance Method Details
#backup_root ⇒ Object
18
19
20
21
|
# File 'lib/backup_repos/config.rb', line 18
def backup_root
return if backup_root_dir.blank?
File.expand_path(backup_root_dir)
end
|
#config_file ⇒ Object
38
39
40
|
# File 'lib/backup_repos/config.rb', line 38
def config_file
File.join(Dir.home, '.backup-repos')
end
|
14
15
16
|
# File 'lib/backup_repos/config.rb', line 14
def debug
options.debug || config['debug']
end
|
#github_access_token ⇒ Object
23
24
25
26
|
# File 'lib/backup_repos/config.rb', line 23
def github_access_token
config_token = config['github']['access_token'] if config['github']
options.github_access_token || config_token
end
|
#respond_to_missing?(name, include_private = false) ⇒ Boolean
34
35
36
|
# File 'lib/backup_repos/config.rb', line 34
def respond_to_missing?(name, include_private = false)
options.respond_to?(name) || config.key?(name.to_s) || super
end
|