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.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #process {|process| ... } ⇒ Object
- #server {|server| ... } ⇒ Object
- #service {|service| ... } ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
77 78 79 80 81 82 |
# File 'lib/nonnative/configuration.rb', line 77 def initialize @strategy = Strategy.new @processes = [] @servers = [] @services = [] end |
Instance Attribute Details
#processes ⇒ Object
Returns the value of attribute processes.
84 85 86 |
# File 'lib/nonnative/configuration.rb', line 84 def processes @processes end |
#servers ⇒ Object
Returns the value of attribute servers.
84 85 86 |
# File 'lib/nonnative/configuration.rb', line 84 def servers @servers end |
#services ⇒ Object
Returns the value of attribute services.
84 85 86 |
# File 'lib/nonnative/configuration.rb', line 84 def services @services end |
#strategy ⇒ Object
Returns the value of attribute strategy.
85 86 87 |
# File 'lib/nonnative/configuration.rb', line 85 def strategy @strategy end |
Class Method Details
.load_file(path) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# 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) services(file, c) end end |
Instance Method Details
#process {|process| ... } ⇒ Object
91 92 93 94 95 96 |
# File 'lib/nonnative/configuration.rb', line 91 def process process = Nonnative::ConfigurationProcess.new yield process processes << process end |
#server {|server| ... } ⇒ Object
98 99 100 101 102 103 |
# File 'lib/nonnative/configuration.rb', line 98 def server server = Nonnative::ConfigurationServer.new yield server servers << server end |
#service {|service| ... } ⇒ Object
105 106 107 108 109 110 |
# File 'lib/nonnative/configuration.rb', line 105 def service service = Nonnative::ConfigurationService.new yield service services << service end |