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.
5
6
7
8
|
# File 'lib/pec/configure.rb', line 5
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
22
23
24
|
# File 'lib/pec/configure.rb', line 22
def method_missing(method, *args)
@_config[1][method.to_s]
end
|
Instance Method Details
#inspect ⇒ Object
10
11
12
|
# File 'lib/pec/configure.rb', line 10
def inspect
@_config
end
|
#keys ⇒ Object
18
19
20
|
# File 'lib/pec/configure.rb', line 18
def keys
@_config[1].keys
end
|
#name ⇒ Object
14
15
16
|
# File 'lib/pec/configure.rb', line 14
def name
@_config[0]
end
|
#validate(host) ⇒ Object
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/pec/configure.rb', line 26
def validate(host)
%w(
tenant
image
flavor
networks
).each do |k|
raise "host key #{k} is require" unless host[1][k]
end
end
|