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.
-
#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
Constructor Details
#initialize ⇒ Configuration
60 61 62 63 64 |
# File 'lib/nonnative/configuration.rb', line 60 def initialize @strategy = Strategy.new @processes = [] @servers = [] end |
Instance Attribute Details
#processes ⇒ Object
Returns the value of attribute processes.
66 67 68 |
# File 'lib/nonnative/configuration.rb', line 66 def processes @processes end |
#servers ⇒ Object
Returns the value of attribute servers.
66 67 68 |
# File 'lib/nonnative/configuration.rb', line 66 def servers @servers end |
#strategy ⇒ Object
Returns the value of attribute strategy.
67 68 69 |
# File 'lib/nonnative/configuration.rb', line 67 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
73 74 75 76 77 78 |
# File 'lib/nonnative/configuration.rb', line 73 def process process = Nonnative::ConfigurationProcess.new yield process processes << process end |
#server {|server| ... } ⇒ Object
80 81 82 83 84 85 |
# File 'lib/nonnative/configuration.rb', line 80 def server server = Nonnative::ConfigurationServer.new yield server servers << server end |