Class: OsCtld::Container::RawConfigs
- Inherits:
-
Object
- Object
- OsCtld::Container::RawConfigs
show all
- Includes:
- Lockable
- Defined in:
- lib/osctld/container/raw_configs.rb
Constant Summary
collapse
- KEYS =
%i[lxc].freeze
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Lockable
#exclusively, included, #inclusively, #init_lock, #lock, #unlock
Constructor Details
#initialize(configs = {}) ⇒ RawConfigs
Returns a new instance of RawConfigs.
15
16
17
18
19
|
# File 'lib/osctld/container/raw_configs.rb', line 15
def initialize(configs = {})
init_lock
@data = {}
KEYS.each { |k| @data[k] = configs[k] }
end
|
Class Method Details
.load(config) ⇒ Object
10
11
12
|
# File 'lib/osctld/container/raw_configs.rb', line 10
def self.load(config)
new(config.transform_keys(&:to_sym))
end
|
Instance Method Details
#dump ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/osctld/container/raw_configs.rb', line 31
def dump
inclusively do
if @data.empty?
nil
else
ret = {}
@data.each do |k, v|
ret[k.to_s] = v if v
end
ret
end
end
end
|
#dup ⇒ Object
47
48
49
50
51
52
|
# File 'lib/osctld/container/raw_configs.rb', line 47
def dup
ret = super
ret.init_lock
ret.instance_variable_set('@data', @data.clone)
ret
end
|