Module: RequireFile
- Defined in:
- lib/require_smasher/require_file.rb
Overview
Handle requiring files
Class Method Summary collapse
Class Method Details
.require(files, total = nil) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/require_smasher/require_file.rb', line 7 def require(files, total = nil) raise FileNotInformedError if files.empty? results = require_files(files) results.select! { |r| r[:error] } return if results.empty? raise RequireFileError, (results.map { |result| result[:message] }) if total == results.count require(results.map { |result| result[:file] }, results.count) end |
.require_directories(directories) ⇒ Object
18 19 20 21 22 |
# File 'lib/require_smasher/require_file.rb', line 18 def require_directories(directories) raise DirNotInformedError if directories.empty? require(FileSmasher.files(directories)) end |