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
Returns a new instance of Configuration.
43 44 45 46 47 |
# File 'lib/nonnative/configuration.rb', line 43 def initialize self.strategy = :before self.processes = [] self.servers = [] end |
Instance Attribute Details
#processes ⇒ Object
Returns the value of attribute processes.
50 51 52 |
# File 'lib/nonnative/configuration.rb', line 50 def processes @processes end |
#servers ⇒ Object
Returns the value of attribute servers.
51 52 53 |
# File 'lib/nonnative/configuration.rb', line 51 def servers @servers end |
#strategy ⇒ Object
Returns the value of attribute strategy.
49 50 51 |
# File 'lib/nonnative/configuration.rb', line 49 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
53 54 55 56 57 58 |
# File 'lib/nonnative/configuration.rb', line 53 def process process = Nonnative::ConfigurationProcess.new yield process processes << process end |
#server {|server| ... } ⇒ Object
60 61 62 63 64 65 |
# File 'lib/nonnative/configuration.rb', line 60 def server server = Nonnative::ConfigurationServer.new yield server servers << server end |