Module: MongoSync::Configuration

Defined in:
lib/mongo_sync/config.rb

Defined Under Namespace

Classes: FileNotFound

Class Method Summary collapse

Class Method Details

.parse(config_file) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/mongo_sync/config.rb', line 5

def self.parse(config_file)
	config_file ||= File.join(Rails.root, 'config', 'mongo_sync.yml') if defined? Rails

	if config_file
		begin
			return YAML::load(IO.read(config_file))
		rescue Errno::ENOENT
			raise FileNotFound
		end
	else
		raise FileNotFound
	end
end