Skip to content

Commit c9520f6

Browse files
authored
Merge pull request #22308 from Homebrew/sorbet-files-update
sorbet: Update RBI files.
2 parents 87eb521 + 39ee328 commit c9520f6

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

  • Library/Homebrew/sorbet/tapioca/compilers/cask

Library/Homebrew/sorbet/tapioca/compilers/cask/config.rb

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,29 @@ module Compilers
99
class CaskConfig < Tapioca::Dsl::Compiler
1010
ConstantType = type_member { { fixed: T::Module[T.anything] } }
1111

12+
# Dirs defined in `OS::Linux::Cask::Config::ClassMethods::DEFAULT_DIRS`
13+
# that aren't visible to `Cask::Config.defaults` when this compiler is
14+
# run on macOS, but still need accessor methods generated in the RBI.
15+
LINUX_ONLY_DIRS = T.let([:appimagedir].freeze, T::Array[Symbol])
16+
1217
sig { override.returns(T::Enumerable[T::Module[T.anything]]) }
1318
def self.gather_constants = [Cask::Config]
1419

1520
sig { override.void }
1621
def decorate
22+
keys = Cask::Config.defaults.keys | LINUX_ONLY_DIRS
23+
1724
root.create_module("Cask") do |mod|
1825
mod.create_class("Config") do |klass|
19-
Cask::Config.defaults.each do |key, value|
26+
keys.each do |key|
2027
return_type = if key == :languages
2128
# :languages is a `LazyObject`, so it lazily evaluates to an
2229
# array of strings when a method is called on it.
2330
"T::Array[String]"
2431
elsif key.end_with?("?")
2532
"T::Boolean"
2633
else
27-
value.class.to_s
34+
"String"
2835
end
2936

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

0 commit comments

Comments
 (0)