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
#initialize(micon, name) ⇒ Config
Returns a new instance of Config.
3 4 5 |
# File 'lib/micon/config.rb', line 3 def initialize micon, name @micon, @name = micon, name end |
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 |
# 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])} if micon.runtime_path? config = {} files.compact.each do |f| 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}="] = v} end config.empty? ? nil : config end |