Sha256: 7b101c273210932f3a34864d268ba0f4a47130b563b1fda800a71cdccac82e60
Contents?: true
Size: 738 Bytes
Versions: 1
Compression:
Stored size: 738 Bytes
Contents
require "lazy_require/version" module LazyRequire def self.load(files) files = toArray(files) failed_files = try_to_require(files) if failed_files.length == files.length raise "Could not load files: \n#{failed_files.join("\n")}\n" elsif failed_files.length != 0 self.load(failed_files) end true end def self.load_all(glob) files = Dir[glob] self.load(files) end private def self.toArray(files) if files.is_a?(Array) files else [files] end end def self.try_to_require(files) failed = [] files.each do |file| begin require "#{file}" rescue NameError => e failed << file end end failed end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lazy_require-0.1.0 | lib/lazy_require.rb |