Skip to content

Instantly share code, notes, and snippets.

@naosim
Created June 8, 2016 19:10
Show Gist options
  • Save naosim/60cc4fc662c5f23adb2dbbea935a954c to your computer and use it in GitHub Desktop.
Save naosim/60cc4fc662c5f23adb2dbbea935a954c to your computer and use it in GitHub Desktop.
Rubyのrequireをファイル名だけ書けばOKにする
$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