lib/require_smasher.rb in require_smasher-0.2.1 vs lib/require_smasher.rb in require_smasher-0.3.0
- old
+ new
@@ -1,35 +1,35 @@
require 'require_smasher/version'
require 'require_smasher/require_gem'
-require 'require_smasher/require_dir'
+require 'require_smasher/require_file'
+require 'require_smasher/require_all'
def require_all(*required_list)
- directories = []
- gems = []
-
- required_list.uniq.each do |required|
- directory = Dir.exist?(required)
- directories << required if directory
- gems << required unless directory
- end
-
- require_gem(gems) unless gems.empty?
- require_dir(directories) unless directories.empty?
+ RequireAll.req(required_list)
end
def require_gem(gems)
return RequireGem.req([gems]) if gems.instance_of?(String)
RequireGem.req(gems)
end
def require_dir(directories)
- return RequireDir.req([directories]) if directories.instance_of?(String)
- RequireDir.req(directories)
+ return RequireFile.require_directories([directories]) if directories.instance_of?(String)
+ RequireFile.require_directories(directories)
end
+def require_file(files)
+ return RequireFile.require_files([files]) if files.instance_of?(String)
+ RequireFile.require_files(files)
+end
+
def require_dirs(*directories)
require_dir(directories)
end
def require_gems(*gems)
require_gem(gems)
+end
+
+def require_files(*files)
+ require_file(files)
end