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

This fixes warnings on Ruby 2.7 #1009

Merged
merged 1 commit into from
Aug 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/faraday/adapter/em_http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,11 @@ def running?
@running
end

def add
def add(&block)
if running?
perform_request { yield }
else
@registered_procs << Proc.new
@registered_procs << block
end
@num_registered += 1
end
Expand Down
2 changes: 1 addition & 1 deletion lib/faraday/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def fetch(key, *args)
if !args.empty?
send(key_setter, args.first)
elsif block_given?
send(key_setter, Proc.new.call(key))
send(key_setter, yield(key))
else
raise self.class.fetch_error_class, "key not found: #{key.inspect}"
end
Expand Down
4 changes: 2 additions & 2 deletions lib/faraday/response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ def finished?
!!env
end

def on_complete
def on_complete(&block)
if !finished?
@on_complete_callbacks << Proc.new
@on_complete_callbacks << block
else
yield(env)
end
Expand Down