HEX
Server: Apache
System: Linux s198.coreserver.jp 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC 2025 x86_64
User: nagasaki (10062)
PHP: 7.1.33
Disabled: NONE
Upload Files
File: //usr/local/rvm/gems/ruby-3.0.2/gems/zeitwerk-2.5.1/lib/zeitwerk/real_mod_name.rb
# frozen_string_literal: true

module Zeitwerk::RealModName
  UNBOUND_METHOD_MODULE_NAME = Module.instance_method(:name)
  private_constant :UNBOUND_METHOD_MODULE_NAME

  # Returns the real name of the class or module, as set after the first
  # constant to which it was assigned (or nil).
  #
  # The name method can be overridden, hence the indirection in this method.
  #
  # @sig (Module) -> String?
  if UnboundMethod.method_defined?(:bind_call)
    def real_mod_name(mod)
      UNBOUND_METHOD_MODULE_NAME.bind_call(mod)
    end
  else
    def real_mod_name(mod)
      UNBOUND_METHOD_MODULE_NAME.bind(mod).call
    end
  end
end