Module: Config
- Defined in:
- lib/config.rb
Overview
Read config file #############################
Instance Method Summary collapse
Instance Method Details
#config ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/config.rb', line 6 def config return @config if @config file=File.($OPTS[:config_file]) if File.exists? file @config||=YAML.load(File.open(file)) else ex=File.(File.join(File.dirname(__FILE__), '..','res','clean.yml')) puts "Warning: config file #{file} not found; using default #{ex}" @config||=YAML.load(File.open(ex)) end end |
#destination_map ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/config.rb', line 20 def destination_map unless @destination_map @destination_map={} config['directories'].each do |directory, extensions| extensions.each do |ext| @destination_map[ext]=directory end end end @destination_map end |