Class: Pec::Configure
- Inherits:
-
Object
show all
- Defined in:
- lib/pec/configure.rb
Instance Method Summary
collapse
Constructor Details
#initialize(config) ⇒ Configure
Returns a new instance of Configure.
3
4
5
6
|
# File 'lib/pec/configure.rb', line 3
def initialize(config)
validate(config)
@_config = config
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
12
13
14
15
|
# File 'lib/pec/configure.rb', line 12
def method_missing(method, *args)
nil unless @_config[1][method.to_s]
@_config[1][method.to_s]
end
|
Instance Method Details
#name ⇒ Object
8
9
10
|
# File 'lib/pec/configure.rb', line 8
def name
@_config[0]
end
|
#validate(host) ⇒ Object
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/pec/configure.rb', line 17
def validate(host)
%w(
tenant
image
flavor
networks
).each do |k|
raise "host key #{k} is require" unless host[1][k]
end
end
|