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.

Instance Method Summary collapse

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.

Parameters:

  • args (T.untyped)


15
16
17
18
19
20
21
22
23
# File 'extend/pathname/eager_initialize_extension.rb', line 15

def initialize(*args)
  @magic_number = T.let(nil, T.nilable(String))
  @file_type = T.let(nil, T.nilable(String))
  @zipinfo = T.let(nil, T.nilable(T::Array[String]))
  @which_install_info = T.let(nil, T.nilable(String))
  @disk_usage = T.let(nil, T.nilable(Integer))
  @file_count = T.let(nil, T.nilable(Integer))
  super
end