Sha256: 577f6366943890163603c020d185a196db2ce5290645aea44841a1905c4d403b

Contents?: true

Size: 485 Bytes

Versions: 2

Compression:

Stored size: 485 Bytes

Contents

# 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?
  def real_mod_name(mod)
    UNBOUND_METHOD_MODULE_NAME.bind_call(mod)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
zeitwerk-2.7.1 lib/zeitwerk/real_mod_name.rb
zeitwerk-2.7.0 lib/zeitwerk/real_mod_name.rb