Sha256: 29ce6d4a616ccb6bc4e30e5c415000d36c0a9b4188816758d2ff2606e9db3bad
Contents?: true
Size: 559 Bytes
Versions: 2
Compression:
Stored size: 559 Bytes
Contents
# # Enumerate files with "extension" in directories called "path" anywhere in the Ruby LOAD_PATH # class Loadable def initialize path = "", extension = '.rb' @path = path @extension = extension end def enumerate $LOAD_PATH. flat_map do |dir| dir_path = (dir+"/"+@path).gsub(%r{//+}, '/') pattern = dir_path+"/**/*"+@extension Dir[pattern]. map do |p| p. sub(%r{#{Regexp.escape(dir_path)}/}, ''). sub(%r{#{@extension}}, '') end end end end if __FILE__ == $0 p Loadable.new(*ARGV).enumerate end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
activefacts-compositions-1.9.8 | lib/activefacts/loadable.rb |
activefacts-compositions-1.9.6 | lib/activefacts/loadable.rb |