扫描并要求目录中的Ruby文件

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了扫描并要求目录中的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

以上是关于扫描并要求目录中的Ruby文件的主要内容,如果未能解决你的问题,请参考以下文章