Class: Nonnative::Configuration
- Inherits:
-
Object
- Object
- Nonnative::Configuration
- Defined in:
- lib/nonnative/configuration.rb
Instance Attribute Summary collapse
-
#processes ⇒ Object
Returns the value of attribute processes.
-
#servers ⇒ Object
Returns the value of attribute servers.
-
#services ⇒ Object
Returns the value of attribute services.
-
#strategy ⇒ Object
Returns the value of attribute strategy.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #load_file(path) ⇒ Object
- #process {|process| ... } ⇒ Object
- #server {|server| ... } ⇒ Object
- #service {|service| ... } ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
5 6 7 8 9 10 |
# File 'lib/nonnative/configuration.rb', line 5 def initialize @strategy = Strategy.new @processes = [] @servers = [] @services = [] end |
Instance Attribute Details
#processes ⇒ Object
Returns the value of attribute processes.
12 13 14 |
# File 'lib/nonnative/configuration.rb', line 12 def processes @processes end |
#servers ⇒ Object
Returns the value of attribute servers.
12 13 14 |
# File 'lib/nonnative/configuration.rb', line 12 def servers @servers end |
#services ⇒ Object
Returns the value of attribute services.
12 13 14 |
# File 'lib/nonnative/configuration.rb', line 12 def services @services end |
#strategy ⇒ Object
Returns the value of attribute strategy.
13 14 15 |
# File 'lib/nonnative/configuration.rb', line 13 def strategy @strategy end |
Instance Method Details
#load_file(path) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/nonnative/configuration.rb', line 15 def load_file(path) file = YAML.load_file(path) self.strategy = file['strategy'] add_processes(file) add_servers(file) add_services(file) end |
#process {|process| ... } ⇒ Object
29 30 31 32 33 34 |
# File 'lib/nonnative/configuration.rb', line 29 def process process = Nonnative::ConfigurationProcess.new yield process processes << process end |
#server {|server| ... } ⇒ Object
36 37 38 39 40 41 |
# File 'lib/nonnative/configuration.rb', line 36 def server server = Nonnative::ConfigurationServer.new yield server servers << server end |
#service {|service| ... } ⇒ Object
43 44 45 46 47 48 |
# File 'lib/nonnative/configuration.rb', line 43 def service service = Nonnative::ConfigurationService.new yield service services << service end |