Class: Architect::Config
- Inherits:
-
Object
- Object
- Architect::Config
- Defined in:
- lib/architect/config.rb
Overview
Parse the configuration file and ARGV variables
Class Method Summary collapse
-
.symbolize_hash(obj) ⇒ Object
TODO: find a better way to do this.
Instance Method Summary collapse
-
#initialize(conffile = nil) ⇒ Config
constructor
A new instance of Config.
- #to_hash ⇒ Object
Constructor Details
#initialize(conffile = nil) ⇒ Config
Returns a new instance of Config.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/architect/config.rb', line 11 def initialize(conffile = nil) config = { :domain => Facter['domain'].value, :plugins => {}, } if conffile.nil? or conffile.kind_of?(String) conffile ||= File.dirname(__FILE__) + "/../../conf/architect.yaml" conffile = File.realpath(conffile) if File.exist?(conffile) config.merge! parse(conffile) else raise "configuration file #{conffile} not found" end elsif conffile.kind_of?(Hash) config.merge! symbolize(conffile) else raise ArgumentError end config.keys.each { |k| publish k } @config = config end |
Class Method Details
.symbolize_hash(obj) ⇒ Object
TODO: find a better way to do this
34 35 36 |
# File 'lib/architect/config.rb', line 34 def self.symbolize_hash(obj) symbolize(obj) end |
Instance Method Details
#to_hash ⇒ Object
7 8 9 |
# File 'lib/architect/config.rb', line 7 def to_hash @config end |