Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add type signatures for TapConfig. #16811

Merged
merged 1 commit into from
Mar 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions Library/Homebrew/tap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1337,27 +1337,31 @@ def tap_migrations

# Permanent configuration per {Tap} using `git-config(1)`.
class TapConfig
sig { returns(Tap) }
attr_reader :tap

sig { params(tap: Tap).void }
def initialize(tap)
@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?

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?

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?
Expand Down