Class: Pec::Configure

Inherits:
Object
  • 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



18
19
20
# File 'lib/pec/configure.rb', line 18

def method_missing(method, *args)
  @_config[1][method.to_s]
end

Instance Method Details

#keys ⇒ Object



14
15
16
# File 'lib/pec/configure.rb', line 14

def keys
  @_config[1].keys
end

#name ⇒ Object



10
11
12
# File 'lib/pec/configure.rb', line 10

def name
  @_config[0]
end

#validate(host) ⇒ Object



22
23
24
25
26
27
28
29
30
31
# File 'lib/pec/configure.rb', line 22

def validate(host)
  %w(
    tenant
    image
    flavor
    networks
  ).each do |k|
    raise "host key #{k} is require" unless host[1][k]
  end
end