class Gantree::Config

Public Class Methods

config_exists?(config) click to toggle source
# File lib/gantree/config.rb, line 20
def config_exists? config
  File.exist? config
end
merge_config(options, config) click to toggle source
# File lib/gantree/config.rb, line 15
def merge_config options, config
  defaults = JSON.parse(File.open(config).read)
  defaults.merge(options)
end
merge_defaults(options={}) click to toggle source
# File lib/gantree/config.rb, line 6
def merge_defaults(options={})
  configs = ["#{ENV['HOME']}/.gantreecfg",".gantreecfg"]
  hash = {}
  configs.each do |config|
    hash.merge!(merge_config(options,config)) if config_exists?(config)
  end
  Hash[hash.map{ |k, v| [k.to_sym, v] }]
end