Class: Pec::Configure
- Inherits:
-
Object
show all
- Defined in:
- lib/pec/sample.rb,
lib/pec/configure.rb
Defined Under Namespace
Classes: Sample
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
16
17
18
|
# File 'lib/pec/configure.rb', line 16
def method_missing(method, *args)
@_config[1][method.to_s]
end
|
Instance Method Details
#keys ⇒ Object
12
13
14
|
# File 'lib/pec/configure.rb', line 12
def keys
@_config[1].keys
end
|
#name ⇒ Object
8
9
10
|
# File 'lib/pec/configure.rb', line 8
def name
@_config[0]
end
|
#validate(host) ⇒ Object
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/pec/configure.rb', line 20
def validate(host)
%w(
tenant
image
flavor
networks
).each do |k|
raise "host key #{k} is require" unless host[1][k]
end
end
|