Skip to content

Commit

Permalink
Add a comment for dirname vs __dir__ usage
Browse files Browse the repository at this point in the history
  • Loading branch information
fxn committed Jun 24, 2024
1 parent 69cee18 commit 85630de
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions actioncable/lib/action_cable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@
require "active_support/rails"
require "zeitwerk"

# We compute lib this way instead of using __dir__ because __dir__ gives a real
# path, while __FILE__ honors symlinks. If the gem is stored under a symlinked
# directory, this matters.
lib = File.dirname(__FILE__)

Zeitwerk::Loader.for_gem.tap do |loader|
loader.ignore(
"#{lib}/rails", # Contains generators, templates, docs, etc.
Expand Down

0 comments on commit 85630de

Please sign in to comment.