Skip to content

Commit

Permalink
This fixes warnings on Ruby 2.7 (lostisland#1009)
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove authored and zenspider committed Nov 22, 2019
1 parent 389ede4 commit 2496bf6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/faraday/adapter/em_http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,11 @@ def reset

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 @@ -72,7 +72,7 @@ def fetch(key, *args)
if args.size > 0
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 @@ -54,9 +54,9 @@ def finished?
!!env
end

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

0 comments on commit 2496bf6

Please sign in to comment.