1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

gemを読むときの前提知識

Last updated at Posted at 2017-10-09
1 / 2

そのgemを使うアプリケーションはgemのコードはどう読み込むか(ざっくり)

active_storageで説明する (https://github.com/rails/rails/tree/master/activestorage)
1, まず lib/active_storage.rb を読む
2, そこでrequireされているものを読む
3, そこで autoload されているやつは必要になったら読む

autoloadとは(ActiveSupport::Autoload)

  • gemを読んでいる時に autoload :Attached みたいに autoloadメソッドにぶつかる
  • そのmoduleが必要になった時に読み込みをしてくれる
  • Module.autoloadの拡張
  • パスを渡さなくても、ファイル名で判断してくれる
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?