Skip to content

Commit

Permalink
Finalize methods that do not support overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
dduugg committed Feb 19, 2024
1 parent c355461 commit b5d07dd
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions Library/Homebrew/requirement.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,15 @@ def message
s
end

# Overriding {#satisfied?} is unsupported.
# Pass a block or boolean to the satisfy DSL method instead.
# Pass a block or boolean to the satisfy DSL method instead of overriding.
sig(:final) {
params(
env: T.nilable(String),
cc: T.nilable(String),
build_bottle: T::Boolean,
bottle_arch: T.nilable(String),
).returns(T::Boolean)
}
def satisfied?(env: nil, cc: nil, build_bottle: false, bottle_arch: nil)
satisfy = self.class.satisfy
return true unless satisfy
Expand All @@ -76,8 +83,8 @@ def satisfied?(env: nil, cc: nil, build_bottle: false, bottle_arch: nil)
true
end

# Overriding {#fatal?} is unsupported.
# Pass a boolean to the fatal DSL method instead.
# Pass a boolean to the fatal DSL method instead of overriding.
sig(:final) { returns(T::Boolean) }
def fatal?
self.class.fatal || false
end
Expand All @@ -92,8 +99,15 @@ def satisfied_result_parent
parent
end

# Overriding {#modify_build_environment} is unsupported.
# Pass a block to the env DSL method instead.
# Pass a block to the env DSL method instead of overriding.
sig(:final) {
params(
env: T.nilable(String),
cc: T.nilable(String),
build_bottle: T::Boolean,
bottle_arch: T.nilable(String),
).returns(T.untyped)
}
def modify_build_environment(env: nil, cc: nil, build_bottle: false, bottle_arch: nil)
satisfied?(env: env, cc: cc, build_bottle: build_bottle, bottle_arch: bottle_arch)
instance_eval(&env_proc) if env_proc
Expand Down

0 comments on commit b5d07dd

Please sign in to comment.