Module: ModuleSync::Util

Defined in:
lib/modulesync/util.rb

Class Method Summary collapse

Class Method Details

.parse_config(config_file) ⇒ Object


9
10
11
12
13
14
15
16
# File 'lib/modulesync/util.rb', line 9

def self.parse_config(config_file)
  if File.exist?(config_file)
    YAML.load_file(config_file) || {}
  else
    puts "No config file under #{config_file} found, using default values"
    {}
  end
end

.symbolize_keys(hash) ⇒ Object


5
6
7
# File 'lib/modulesync/util.rb', line 5

def self.symbolize_keys(hash)
  hash.inject({}) { |memo, (k, v)| memo[k.to_sym] = v; memo }
end