Skip to content

Instantly share code, notes, and snippets.

@sugamasao
Created February 26, 2018 08:02
Show Gist options
  • Save sugamasao/9220562315cd53ed7c835a8cf400d122 to your computer and use it in GitHub Desktop.
Save sugamasao/9220562315cd53ed7c835a8cf400d122 to your computer and use it in GitHub Desktop.
標準ライブラリをrequireしたい
# こんな感じでできそうだけど、内容があってるかは確認してない
Dir.glob(File.join(RbConfig.expand("$(libdir)"), 'ruby', "#{ RUBY_VERSION.split('.')[0, 2].join('.') }.0", "*.rb")).each do |path|
name = File.basename(path, ".rb")
next if %w(profile debug).include? name # こいつらをrequireするとプログラムが色々動いてしまうので除外
require name
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment