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: T::Module[T.anything] } }
LINUX_ONLY_DIRS =

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.

Dirs defined in OS::Linux::Cask::Config::ClassMethods::DEFAULT_DIRS that aren't visible to Cask::Config.defaults when this compiler is run on macOS, but still need accessor methods generated in the RBI.

T.let([:appimagedir].freeze, T::Array[Symbol])

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.gather_constantsEnumerable<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:



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

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.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'sorbet/tapioca/compilers/cask/config.rb', line 21

def decorate
  keys = Cask::Config.defaults.keys | LINUX_ONLY_DIRS

  root.create_module("Cask") do |mod|
    mod.create_class("Config") do |klass|
      keys.each do |key|
        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
          "String"
        end

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