Skip to content

Commit

Permalink
Add type signatures for TapConfig.
Browse files Browse the repository at this point in the history
  • Loading branch information
reitermarkus committed Mar 4, 2024
1 parent 8d4e841 commit 00d6928
Showing 1 changed file with 4 additions and 0 deletions.
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

0 comments on commit 00d6928

Please sign in to comment.