Class: Styoe::ConfigurationResolver
- Inherits:
-
Object
- Object
- Styoe::ConfigurationResolver
- Defined in:
- lib/styoe/configuration_resolver.rb
Instance Method Summary collapse
- #active_processes(path = PID_FILE) ⇒ Object
- #dump_pids(pids, path = DOT_FILE) ⇒ Object
-
#initialize(options = {}) ⇒ ConfigurationResolver
constructor
A new instance of ConfigurationResolver.
- #processes(path = DOT_FILE) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ ConfigurationResolver
10 11 12 |
# File 'lib/styoe/configuration_resolver.rb', line 10 def initialize( = {}) @stop_at = [:stop_at] || '/' end |
Instance Method Details
#active_processes(path = PID_FILE) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/styoe/configuration_resolver.rb', line 14 def active_processes(path = PID_FILE) raise ConfigurationNotFound if stop?(path) return active_processes("../#{path}") unless File.exist?(path) parse_values(path) end |
#dump_pids(pids, path = DOT_FILE) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/styoe/configuration_resolver.rb', line 28 def dump_pids(pids, path = DOT_FILE) raise ConfigurationNotFound if stop?(path) return dump_pids(pids, "../#{path}") unless File.exist?(path) file = File.open(path.gsub(DOT_FILE, PID_FILE), "w") file.write(YAML.dump pids) file.close end |
#processes(path = DOT_FILE) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/styoe/configuration_resolver.rb', line 21 def processes(path = DOT_FILE) raise ConfigurationNotFound if stop?(path) return processes("../#{path}") unless File.exist?(path) parse_values(path) end |