Class: Nonnative::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/nonnative/configuration.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



62
63
64
65
66
# File 'lib/nonnative/configuration.rb', line 62

def initialize
  @strategy = Strategy.new
  @processes = []
  @servers = []
end

Instance Attribute Details

#processesObject

Returns the value of attribute processes.



68
69
70
# File 'lib/nonnative/configuration.rb', line 68

def processes
  @processes
end

#serversObject

Returns the value of attribute servers.



68
69
70
# File 'lib/nonnative/configuration.rb', line 68

def servers
  @servers
end

#strategyObject

Returns the value of attribute strategy.



69
70
71
# File 'lib/nonnative/configuration.rb', line 69

def strategy
  @strategy
end

Class Method Details

.load_file(path) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/nonnative/configuration.rb', line 6

def load_file(path)
  file = YAML.load_file(path)

  new.tap do |c|
    c.strategy = file['strategy']

    processes(file, c)
    servers(file, c)
  end
end

Instance Method Details

#process {|process| ... } ⇒ Object

Yields:



75
76
77
78
79
80
# File 'lib/nonnative/configuration.rb', line 75

def process
  process = Nonnative::ConfigurationProcess.new
  yield process

  processes << process
end

#server {|server| ... } ⇒ Object

Yields:



82
83
84
85
86
87
# File 'lib/nonnative/configuration.rb', line 82

def server
  server = Nonnative::ConfigurationServer.new
  yield server

  servers << server
end