Add type signatures for TapConfig.

This commit is contained in:
Markus Reiter 2024-02-23 15:10:44 +01:00
parent 8d4e841965
commit 00d69284e4
No known key found for this signature in database
GPG Key ID: 245293B51702655B

View File

@ -1337,6 +1337,7 @@ end
# Permanent configuration per {Tap} using `git-config(1)`.
class TapConfig
sig { returns(Tap) }
attr_reader :tap
sig { params(tap: Tap).void }
@ -1344,6 +1345,7 @@ class TapConfig
@tap = tap
end
sig { params(key: T.any(Symbol, String)).returns(T.nilable(String)) }
def [](key)
return unless tap.git?
return unless Utils::Git.available?
@ -1351,6 +1353,7 @@ class TapConfig
Homebrew::Settings.read key, repo: tap.path
end
sig { params(key: T.any(Symbol, String), value: T.any(T::Boolean, String)).void }
def []=(key, value)
return unless tap.git?
return unless Utils::Git.available?
@ -1358,6 +1361,7 @@ class TapConfig
Homebrew::Settings.write key, value.to_s, repo: tap.path
end
sig { params(key: T.any(Symbol, String)).void }
def delete(key)
return unless tap.git?
return unless Utils::Git.available?