Method: Connect::Includer#include
- Defined in:
- lib/connect/includer.rb
#include(name, &proc) {|name, content| ... } ⇒ Object
Check the the name of the inclusion and decide what to do. The result(s) will be yielded to the specfied closure. This routine can handle:
-
absolute file names without wildcards
-
absolute file names with a wildcard
-
relative file names without wildcards
-
relative file names with a wildcard
If a file extention is not givcen, it will use the default_type
33 34 35 36 37 38 39 40 41 |
# File 'lib/connect/includer.rb', line 33 def include(name, &proc) path = Pathname.new(name) path = with_extension(path) if no_extension?(path) path = with_folder(path) unless path.absolute? files = Dir.glob(path).each do |file| include_file(file, &proc) end fail ArgumentError, "No files found for #{name}" if files.empty? end |