Class: Necro::Config
- Inherits:
-
Object
- Object
- Necro::Config
- Defined in:
- lib/necro/config.rb
Instance Attribute Summary collapse
-
#processes ⇒ Object
Returns the value of attribute processes.
Instance Method Summary collapse
-
#initialize(filename) ⇒ Config
constructor
A new instance of Config.
- #process_ini(ini_content) ⇒ Object
Constructor Details
#initialize(filename) ⇒ Config
Returns a new instance of Config.
7 8 9 10 |
# File 'lib/necro/config.rb', line 7 def initialize(filename) @ini_content = File.read(filename) @processes = process_ini(@ini_content) end |
Instance Attribute Details
#processes ⇒ Object
Returns the value of attribute processes.
6 7 8 |
# File 'lib/necro/config.rb', line 6 def processes @processes end |
Instance Method Details
#process_ini(ini_content) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/necro/config.rb', line 12 def process_ini(ini_content) document = IniParse.parse(ini_content) document.map do |section| OpenStruct.new(label: section.key, dir: section["directory"], cmd: section["command"]) end end |