Top Level Namespace

Defined Under Namespace

Modules: MysqlBackup Classes: Array

Instance Method Summary collapse

Instance Method Details

#load_relative(path) ⇒ Object



25
26
27
# File 'lib/mysql_backup/extensions.rb', line 25

def load_relative(path)
	load File.expand_path path, this_dir()
end

#this_dirObject



20
21
22
23
# File 'lib/mysql_backup/extensions.rb', line 20

def this_dir
	file = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__
	File.expand_path File.dirname(file)
end

#try_load(paths) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/mysql_backup/extensions.rb', line 11

def try_load(paths)
	Array.from(paths).each do |path|
		result = try_load_file path
		return result if !result.nil?
	end

	return nil
end

#try_load_file(path) ⇒ Object



2
3
4
5
6
7
8
9
# File 'lib/mysql_backup/extensions.rb', line 2

def try_load_file(path)
	begin
		load_relative path
		return path
	rescue LoadError => e
		return nil
	end
end