Class: Micon::Config
- Inherits:
-
Object
- Object
- Micon::Config
- Defined in:
- lib/micon/config.rb
Instance Attribute Summary collapse
-
#micon ⇒ Object
readonly
Returns the value of attribute micon.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(micon, name) ⇒ Config
constructor
A new instance of Config.
- #load ⇒ Object
Constructor Details
Instance Attribute Details
#micon ⇒ Object (readonly)
Returns the value of attribute micon.
2 3 4 |
# File 'lib/micon/config.rb', line 2 def micon @micon end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
2 3 4 |
# File 'lib/micon/config.rb', line 2 def name @name end |
Instance Method Details
#load ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/micon/config.rb', line 7 def load files = [] files.push *config_paths.collect{|path| find_file(path, $LOAD_PATH)} files.push *runtime_config_paths.collect{|path| find_file(path, [micon.runtime_path])} config = {} files.compact.each do |f| require 'yaml' c = YAML.load_file(f) next unless c raise "component config must be a Hash (#{f})!" unless c.is_a? Hash c.each{|k, v| config[k.to_sym] = v} end config.empty? ? nil : config end |