Class: Pec::Configure

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/pec/configure.rb,
lib/pec/configure/host.rb,
lib/pec/configure/sample.rb,
lib/pec/configure/ethernet.rb,
lib/pec/configure/user_data.rb

Defined Under Namespace

Classes: Ethernet, Host, Sample, UserData

Instance Method Summary collapse

Instance Method Details

#each ⇒ Object



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

def each
  @configure.each do |config|
    yield config
  end
end

#load(file_name) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/pec/configure.rb', line 6

def load(file_name)
  YAML.load_file(file_name).to_hash.each do |config|
    host = Pec::Configure::Host.load(config)
    @configure ||= []
    @configure << host if host
  end
  rescue Psych::SyntaxError,NoMethodError => e
    raise(Pec::Errors::Configure, e)
end