Class: Invoker::Parsers::Config
- Inherits:
-
Object
- Object
- Invoker::Parsers::Config
- Defined in:
- lib/invoker/parsers/config.rb
Constant Summary collapse
- PORT_REGEX =
/\$PORT/
Instance Attribute Summary collapse
-
#power_config ⇒ Object
Returns the value of attribute power_config.
-
#processes ⇒ Object
Returns the value of attribute processes.
Instance Method Summary collapse
- #dns_port ⇒ Object
- #http_port ⇒ Object
-
#initialize(filename, port) ⇒ Config
constructor
A new instance of Config.
- #process(label) ⇒ Object
Constructor Details
#initialize(filename, port) ⇒ Config
Returns a new instance of Config.
9 10 11 12 13 14 15 16 |
# File 'lib/invoker/parsers/config.rb', line 9 def initialize(filename, port) @ini_content = File.read(filename) @port = port @processes = process_ini(@ini_content) if Invoker.can_run_balancer? @power_config = Invoker::Power::Config.load_config() end end |
Instance Attribute Details
#power_config ⇒ Object
Returns the value of attribute power_config.
7 8 9 |
# File 'lib/invoker/parsers/config.rb', line 7 def power_config @power_config end |
#processes ⇒ Object
Returns the value of attribute processes.
7 8 9 |
# File 'lib/invoker/parsers/config.rb', line 7 def processes @processes end |
Instance Method Details
#dns_port ⇒ Object
22 23 24 |
# File 'lib/invoker/parsers/config.rb', line 22 def dns_port power_config && power_config.dns_port end |
#http_port ⇒ Object
18 19 20 |
# File 'lib/invoker/parsers/config.rb', line 18 def http_port power_config && power_config.http_port end |
#process(label) ⇒ Object
26 27 28 29 30 |
# File 'lib/invoker/parsers/config.rb', line 26 def process(label) processes.detect {|pconfig| pconfig.label == label } end |