Class: BackupDemon::Config
- Inherits:
-
Object
- Object
- BackupDemon::Config
show all
- Defined in:
- lib/backup_demon/config.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(options = {}) ⇒ Config
Returns a new instance of Config.
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/backup_demon/config.rb', line 8
def initialize(options = {})
@options = {
daemon: false,
interval: 5,
pid: nil,
device: "/dev/sdb1",
mount: "/mnt/backuphdd",
directories: ""
}.merge!(options.symbolize_keys!)
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name) ⇒ Object
31
32
33
34
35
36
|
# File 'lib/backup_demon/config.rb', line 31
def method_missing(name)
name = name.to_sym
if @options.has_key?(name)
@options[name]
end
end
|
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
6
7
8
|
# File 'lib/backup_demon/config.rb', line 6
def options
@options
end
|
Instance Method Details
#directories ⇒ Object
27
28
29
|
# File 'lib/backup_demon/config.rb', line 27
def directories
@options[:directories]
end
|
#interval ⇒ Object
23
24
25
|
# File 'lib/backup_demon/config.rb', line 23
def interval
@options[:interval].to_f
end
|
#timeout ⇒ Object
19
20
21
|
# File 'lib/backup_demon/config.rb', line 19
def timeout
@options[:timeout].to_f
end
|