-
Notifications
You must be signed in to change notification settings - Fork 968
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
Fix "method redefined" warnings introduced in Faraday 2.7.5 #1506
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -174,6 +174,7 @@ def self.memoized(key, &block) | |||
|
||||
memoized_attributes[key.to_sym] = block | ||||
class_eval <<-RUBY, __FILE__, __LINE__ + 1 | ||||
remove_method(key) if method_defined?(key, false) | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗒️ The The specs have an example of faraday/spec/faraday/options/options_spec.rb Line 260 in d40f3db
|
||||
def #{key}() self[:#{key}]; end | ||||
RUBY | ||||
end | ||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,6 +42,7 @@ def self.create(request_method) | |
end | ||
end | ||
|
||
remove_method :params= | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗒️ Since I've applied this pattern to the other method definitions that were triggering warnings. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, that makes sense now! Before the switch from inheritance ( Great catch! |
||
# Replace params, preserving the existing hash type. | ||
# | ||
# @param hash [Hash] new params | ||
|
@@ -53,6 +54,7 @@ def params=(hash) | |
end | ||
end | ||
|
||
remove_method :headers= | ||
# Replace request headers, preserving the existing hash type. | ||
# | ||
# @param hash [Hash] new headers | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗒️ This ensures that Ruby warnings are printed when running the specs.