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

#initialize ⇒ Configuration

Returns a new instance of Configuration.



58
59
60
61
62
# File 'lib/nonnative/configuration.rb', line 58

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

Instance Attribute Details

#processes ⇒ Object

Returns the value of attribute processes.



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

def processes
  @processes
end

#servers ⇒ Object

Returns the value of attribute servers.



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

def servers
  @servers
end

#strategy ⇒ Object

Returns the value of attribute strategy.



65
66
67
# File 'lib/nonnative/configuration.rb', line 65

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:



71
72
73
74
75
76
# File 'lib/nonnative/configuration.rb', line 71

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

  processes << process
end

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

Yields:



78
79
80
81
82
83
# File 'lib/nonnative/configuration.rb', line 78

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

  servers << server
end