Created
June 8, 2016 19:10
-
-
Save naosim/60cc4fc662c5f23adb2dbbea935a954c to your computer and use it in GitHub Desktop.
Rubyのrequireをファイル名だけ書けばOKにする
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ruby_file_list = `find -name "**.rb"`.split("\n") | |
def requiree(filename) | |
result_list = $ruby_file_list.select {|line| line.include?(filename)} | |
if result_list.length == 0 then | |
throw "file not found: #{filename}", 1 | |
end | |
require(result_list[0]) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment