Sha256: f8233c1ec0dd1a964c45c8b380bb19836fb978200510983ec92d5da7dbb2a246
Contents?: true
Size: 669 Bytes
Versions: 3
Compression:
Stored size: 669 Bytes
Contents
require 'yaml' module YAMLConfig def initialize super() configure_if_config_exists(self.class.to_s.downcase) end def YAMLConfig.extend_object(obj) obj.configure_if_config_exists(obj.class.to_s.downcase) end def configure_if_config_exists(task_name) task_config = task_name + '.yml' configure(task_config) if File.exists?(task_config) end def configure(yml_file) config = YAML::load(File.open(yml_file)) parse_config config end def parse_config(config) config.each do |key, value| setter = "#{key}=" self.class.send(:attr_accessor, key) if !respond_to?(setter) send setter, value end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
albacore-0.0.9 | lib/albacore/support/yamlconfig.rb |
albacore-0.0.8 | lib/albacore/support/yamlconfig.rb |
albacore-0.0.7 | lib/albacore/support/yamlconfig.rb |