We Recommend

Beginning Ruby: From Novice to Professional Beginning Ruby: From Novice to Professional
Beginning Ruby is a thoroughly contemporary guide for every type of reader wanting to learn Ruby, from novice programmers to web developers to Ruby newcomers. It starts by explaining the principles behind object-oriented programming and within a few chapters builds toward creating a genuine Ruby application.


Posted By

jccovey on 06/20/08


Tagged

files directory require scan


Versions (?)


Scan and Require Ruby Files in Directory


Published in: Ruby 


Requires all Ruby source files in a given directory.

  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 

You need to login to post a comment.