Sha256: ef75d99490dbe9d213ccbf0438747004218bb5f7d59c57dc7412ed6d0085fabb
Contents?: true
Size: 995 Bytes
Versions: 2
Compression:
Stored size: 995 Bytes
Contents
# Handle requiring files module RequireFile class << self def require(files) raise FileNotInformedError if files.empty? errors_list = require_files(files) files_with_error = errors_list[:files_with_error] return if files_with_error.empty? raise RequireFileError, errors_list[:errors] if files == files_with_error require(files_with_error) end def require_directories(directories) raise DirNotInformedError if directories.empty? require(FileSmasher.files(directories)) end private def require_files(files) errors_list = { files_with_error: [], errors: [] } files.uniq.each do |file| begin require_relative File.expand_path("./#{file}") rescue LoadError, StandardError => error errors_list[:files_with_error] << file errors_list[:errors] << "Error while requiring file #{file}: #{error.message}" end end errors_list end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
require_smasher-0.4.1 | lib/require_smasher/require_file.rb |
require_smasher-0.4.0 | lib/require_smasher/require_file.rb |