Class: Tapioca::Compilers::CaskConfig

Inherits:
Dsl::Compiler
  • Object
show all
Defined in:
sorbet/tapioca/compilers/cask/config.rb

Constant Summary collapse

ConstantType =
type_member { { fixed: Module } }

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.gather_constantsEnumerable<Module>

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:



13
# File 'sorbet/tapioca/compilers/cask/config.rb', line 13

def self.gather_constants = [Cask::Config]

Instance Method Details

#decoratevoid

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.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'sorbet/tapioca/compilers/cask/config.rb', line 16

def decorate
  root.create_module("Cask") do |mod|
    mod.create_class("Config") do |klass|
      Cask::Config.defaults.each do |key, value|
        return_type = if key == :languages
          # :languages is a `LazyObject`, so it lazily evaluates to an
          # array of strings when a method is called on it.
          "T::Array[String]"
        elsif key.end_with?("?")
          "T::Boolean"
        else
          value.class.to_s
        end

        klass.create_method(key.to_s, return_type:, class_method: false)
      end
    end
  end
end