Scan and Require Ruby Files in Directory

/ Published in: Ruby
Save to your folder(s)

Requires all Ruby source files in a given directory.

Copy this code and paste it in your HTML
  1. class Dir
  2. def self.require_all(directory)
  3. self.entries(directory).each do |file|
  4. if file =~ /\.rb/
  5. require directory + file
  6. end
  7. end
  8. end
  9. end

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.