Module: EagerInitializeExtension Private
- Extended by:
- T::Helpers
- Included in:
- Pathname
- Defined in:
- extend/pathname/eager_initialize_extension.rb
Overview
This module is part of a private API. This module may only be used in the Homebrew/brew repository. Third parties should avoid using this module if possible, as it may be removed or changed without warning.
Eagerly initialises Pathname's lazy memoised ivars so every instance shares one object shape, avoiding Ruby's shape-variation warning.
Any new @x ||= ... ivar added to Pathname or its mixed-in extensions
must also be added to #initialize below to keep the shape stable.
Constant Summary collapse
- NilableString =
This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.
These aliases hoist the
T.nilable(...)type objects out of the hot path.#initializeruns on every Pathname allocation, and with runtime checks disabledT.letdiscards its type argument, so evaluatingT.nilable(...)inline would rebuild the same type objects each time. T.type_alias { T.nilable(String) }
- NilableInteger =
This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.
T.type_alias { T.nilable(Integer) }
- NilableStringArray =
This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.
T.type_alias { T.nilable(T::Array[String]) }
Instance Method Summary collapse
- #initialize(*args) ⇒ void private
Instance Method Details
#initialize(*args) ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
23 24 25 26 27 28 29 30 31 |
# File 'extend/pathname/eager_initialize_extension.rb', line 23 def initialize(*args) @magic_number = T.let(nil, NilableString) @file_type = T.let(nil, NilableString) @zipinfo = T.let(nil, NilableStringArray) @which_install_info = T.let(nil, NilableString) @disk_usage = T.let(nil, NilableInteger) @file_count = T.let(nil, NilableInteger) super end |