Spec-Zone.ru › Homebrew

Class: Tapioca::Compilers::Forwardables

Inherits:
Dsl::Compiler
  • Object
  • Dsl::Compiler
  • Tapioca::Compilers::Forwardables
show all
Defined in:
sorbet/tapioca/compilers/forwardables.rb

Constant Summary collapse

FORWARDABLE_FILENAME =
"forwardable.rb"
ARRAY_METHODS =
T.let(["to_a", "to_ary"].freeze, T::Array[String])
HASH_METHODS =
T.let(["to_h", "to_hash"].freeze, T::Array[String])
STRING_METHODS =
T.let(["to_s", "to_str", "to_json"].freeze, T::Array[String])
RETURN_TYPE_OVERRIDES =

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.

Use this to override the default return type of a forwarded method:

T.let({
  "::Cask::Cask" => {
    "on_system_block_min_os" => "T.nilable(MacOSVersion)",
    "url"                    => "T.nilable(::Cask::URL)",
  },
}.freeze, T::Hash[String, T::Hash[String, String]])
ConstantType =
type_member { { fixed: T::Module[T.anything] } }

Class Method Summary collapse

  • .gather_constants ⇒ Enumerable<T::Module[T.anything]> private

Instance Method Summary collapse

  • #decorate ⇒ void private

Class Method Details

.gather_constants ⇒ Enumerable<T::Module[T.anything]>

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.

Returns:

  • (Enumerable<T::Module[T.anything]>)


26
27
28
29
30
31
# File 'sorbet/tapioca/compilers/forwardables.rb', line 26

def self.gather_constants
  Homebrew::Tapioca::Utils.named_objects_with_module(Forwardable).reject do |obj|
    # Avoid duplicate stubs for forwardables that are defined in vendored gems
    Object.const_source_location(T.must(obj.name))&.first&.include?("vendor/bundle/ruby")
  end
end

Instance Method Details

#decorate ⇒ 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.

This method returns an undefined value.



34
35
36
37
38
39
40
41
# File 'sorbet/tapioca/compilers/forwardables.rb', line 34

def decorate
  root.create_path(constant) do |klass|
    Homebrew::Tapioca::Utils.methods_from_file(constant, FORWARDABLE_FILENAME)
                            .each { |method| compile_forwardable_method(klass, method) }
    Homebrew::Tapioca::Utils.methods_from_file(constant, FORWARDABLE_FILENAME, class_methods: true)
                            .each { |method| compile_forwardable_method(klass, method, class_method: true) }
  end
end

© 2009–present Homebrew contributors
Licensed under the BSD 2-Clause License.
https://docs.brew.sh/rubydoc/Tapioca/Compilers/Forwardables.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API