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
58 59 60 61 62 |
# File 'lib/nonnative/configuration.rb', line 58 def initialize self.strategy = :before self.processes = [] self.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.
64 65 66 |
# File 'lib/nonnative/configuration.rb', line 64 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
66 67 68 69 70 71 |
# File 'lib/nonnative/configuration.rb', line 66 def process process = Nonnative::ConfigurationProcess.new yield process processes << process end |
#server {|server| ... } ⇒ Object
73 74 75 76 77 78 |
# File 'lib/nonnative/configuration.rb', line 73 def server server = Nonnative::ConfigurationServer.new yield server servers << server end |