Sha256: bd492c15c6dbef99f637835cc2d7541b18de1020470c129c0b054212b84bd4b2

Contents?: true

Size: 570 Bytes

Versions: 7

Compression:

Stored size: 570 Bytes

Contents

require 'yaml'

module ModuleSync
  module Util

    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
  end
end

class Hash
  #take keys of hash and transform those to a symbols
  def self.transform_keys_to_symbols(value)
    return value if not value.is_a?(Hash)
    hash = value.inject({}){|memo,(k,v)| memo[k.to_sym] = Hash.transform_keys_to_symbols(v); memo}
    return hash
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
modulesync-0.6.1 lib/modulesync/util.rb
modulesync-0.6.0 lib/modulesync/util.rb
modulesync-0.5.0 lib/modulesync/util.rb
modulesync-0.4.0 lib/modulesync/util.rb
modulesync-0.3.0 lib/modulesync/util.rb
modulesync-0.2.0 lib/modulesync/util.rb
modulesync-0.1.0 lib/modulesync/util.rb