Class: OpsManager::Config::Base
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- OpsManager::Config::Base
show all
- Defined in:
- lib/ops_manager/config/base.rb
Instance Method Summary
collapse
Constructor Details
#initialize(config) ⇒ Base
Returns a new instance of Base.
6
7
8
|
# File 'lib/ops_manager/config/base.rb', line 6
def initialize(config)
super(config.to_symbolize)
end
|
Instance Method Details
#expand_path_for!(*attrs) ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/ops_manager/config/base.rb', line 16
def expand_path_for!(*attrs)
attrs.each do |attr|
path = self[attr]
next if path.nil?
self[attr] = if path =~ %r{^file://}
path = Dir.glob(path.gsub!('file://','')).first
"file://#{path}"
else
Dir.glob(path).first
end
end
end
|
#validate_presence_of!(*attrs) ⇒ Object
10
11
12
13
14
|
# File 'lib/ops_manager/config/base.rb', line 10
def validate_presence_of!(*attrs)
attrs.each do |attr|
raise "missing #{attr} on config" unless self.to_h.has_key?(attr)
end
end
|